Disable final modifier in interfaces

you can set the code style inside eclipse to use the final modifier where possible. Unfortunately, this modifier is also installed in the interfaces. But there it makes no sense. Is it possible to prevent the installation of the "final" modifier for method parameters in interfaces? Just to figure it out. I do not mean fields. They are always final and static. I mean method parameters like "param"

public interface MyService { void aMethod(String param); } 

instead

 public interface MyService { void aMethod(final String param); } 

"final" does not change the logic of the code, but this is optional.

+4
source share
1 answer

You cannot specify behavior for interface vs a class , but you can force it to put final in parameters.

Go to Preferences -> Java -> Code Style -> Clean Up , edit the profile and select the Code Style tab. At the bottom, under Variable Declarations clear the Parameter check box.

+2
source

All Articles