Home > Software engineering >  IntelliJ - Hotkey for add all final modifiers where possible?
IntelliJ - Hotkey for add all final modifiers where possible?

Time:01-11

I've spent half my life in Eclipse, now transitioning to IntelliJ. Old habigs die hard :-)7

I really liked the functionality of Ctrl A, Ctrl 1, add finals where possible to an extent it is in my muscle memory. Pls let's try to avoid the debate of usefulness/necessity. Pretty pls :-)

Is there a way to do the same in IntelliJ?

CodePudding user response:

  • enable inspection "Preferences | Editor | Inspections | Java | Code style issues | Local variable or parameter can be 'final'", and run "Code | Code Cleanup"
  • you can use "Code | Reformat code" with "Code cleanup" checked in the dialog
  • also, you can make generated local variables and parameters final by default in "Preferences | Editor | Code Style | Java | Code Generation"
  • Related