Community
Participate
Working Groups
This function can be provide with the "Format" function
I think this function should be provided with "Format" when you press Ctrl+Shift+F You can config this in the Window -> Preferences -> Java -> Code Style -> Formatter -> Edit
The formatter has no notion of unchanged variables. It simply manages the whitespaces for a stream of tokens.
Maybe Eclipse can use "Quick fix" to do this.
Then move to JDT/UI
+1 A Quick Fix or similiar in Eclipse for this operations would mean a lot to improving code, hence removing simple bugs. Especially, since I don't know of any other Java IDE/tools that does this for you. An article "Seven Low-Cost Ways to Improve Legacy Code" http://www.onjava.com/pub/a/onjava/2004/04/28/hardcorejava.html brings this up in the third section Introduce final All Over Your Code. PMD detects this as well by warning that "Local variable could be declared final". Just to clear things up by, bug reporter mentioned "unchanged variables and properties", that is, variables in immutable classes, local unchanged variables and all parameters except for in-out parameters. I would really like to see this for 3.2 final release.
See also Bug 108558
The "PMD Eclipse Lite" plugin can add the "final" keyword unconditionally to all parameters See http://sourceforge.net/projects/pmd-eclipse/
fixed > I20060221-1300 Added make final if possible: quick assist and clean up for private fields, parameters and local variables.
Wow, that was quick. Thanks Benno!