views:

465

answers:

3

Can Eclipse make parameters for generated methods (overwriting, implementing interface, etc.) final. If yes - how?

If I'm not mistaken, then IntelliJ had an option for it. I could not something similar in Eclipse.

This has become a part of my coding style and I am making parameters final manually, but there has to be a faster way :P

/JaanusSiim

A: 

There's cleanup options under 'Project' -> 'Preferences' -> 'Java Code Style' -> 'Clean up', but these can be applied after code has been generated...

JaanusSiim
+3  A: 

AFAIK, that is not possible. I've not found any option to customize it under Window > Preferences > Java > Editor > Templates or under Window > Preferences > Java > Code Style > Code Templates.

Anyway, Eclipse 3.3+ comes with "save actions", an alternative mechanism for doing that. Under Preferencens > Java > Editors > Save actions it is possible to configure "additional save actions". On the code style tab there is an option to automatically add final modifiers to private fields, method parameters and local variables.

Guido
+2  A: 

It is indeed in the "save actions". Check this blog post for a screenshot: Eclipse and the automagical final

Bruno De Fraine
Your link was awesome. Been trying to do this in the new code templates for the last half hour for 10 seconds of work!
WolfmanDragon