This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Hi, it would be nice to have NB to automatically add (as Hint and/or as formatting opion) final modifier to private fields, method parameters and local variables. This is a feature I used in Eclipse. See the URL for better explanation. Thanks, Gualtiero
*** This bug has been marked as a duplicate of bug 125566 ***
Although netbean now hints that a field can be declared as final, this is not sufficient as the original poster had requested final to be added everywhere including "local variables" and "method parameters" (as is the case in eclipse). Also hinting alone is not sufficient. It'd be much nicer if netbean could automatically add final wherever possible (add it as an option to onSave actions instead of hint). This is also the case in eclipse. For these reasons I'm re-opening this issue.
IntelliJ also allows this: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206185619-Auto-add-the-final-modifier-to-newly-declared-variables-values Here is an idea for an additional feature that will help Netbeans stand even higher above Eclipse/IntelliJ. Allow the user (me!) to set a font color for non-final variables and optionally hide the final keyword all together (i.e. it's not displayed in the IDE!). E.g. say 'orange' (for me) represents all non-final variables, that's my chosen visual representation for non-final variables, done :) The 'final' attribute can then be cleanly added to the popup that already shows the variable type (cursor on variable, ctrl + space to see that popup). Thanks for reading!