Coding style format for method parameter in java

Answered

I have one method like this.

public void test(String name) {

}

So when I click ctrl+alt+l I expect it add final format like below.

public void test(final String name) {

}

How to set coding style like that.

Thank you.

0
1 comment

Hi Sean,

You cannot really achieve this with reformatting (generated variables only), but you can enable a certain inspection called "Local variable or parameter can be final" under File | Settings | Editor | Inspections > Java > Code Style. The designated variables or parameters will be automatically highlighted in the code, and you can invoke a quick action on any of them to make them final.

0

Please sign in to leave a comment.