Setting 'Make generated local variables final' not working
Answered
Hi,
I want IDEA to insert 'final' keyword when I use Ctrl+Alt+V to create local variable.
I have setting 'Make generated local variables final' enabled, but it doesn't insert 'final' keyword when I use Ctrl+Alt+V.
This happens since first 2017.x release at the very least, on different machines and different projects.
I've tried restarting, disabling custom plugins and even disabling all the plugins - the problem persists.
It does put 'final' keyword when generates for-loops though, but not when I extract variable for some reason.
Any idea what I might do wrong or what to try next?
Thank you.
Please sign in to leave a comment.
When you invoke the refactoring, there should be a checkbox displayed to declare the variable final:
With this, I would have to check the box every time I extract a variable (since I always want them to be final). This includes moving my hand from the keyboard to the mouse, which is not a very effective way of doing it. The old way of doing this was better, no extra manual step. At least it should remember that I've checked the box for future extracts...
Edit: Now it seems to remember that I want final fields.. Didn't do that the first time..
Yes, this setting persists.