Search code examples
javaintellij-ideafinal

IntelliJ IDEA, turn off insertion of 'final' keyword before instance variables on format/save (JAVA)


I cannot for the life of me find out where I can turn off insertion of the 'final' keyword on instance variables in IntelliJ IDEA.

Basically IntelliJ is checking to see if a instance field is being assigned to and if it isn't its automatically making it final. This wouldn't be a problem usually but I am doing serialization and it is presenting problems.

As a reference (I declare):

 private HashSet<Integer> removedIndex = new HashSet<>();

IntelliJ makes it:

private final HashSet<Integer> removedIndex = new HashSet<>();

Thanks for any help!


Solution

  • Sounds like you are using the Save Actions Plugin. To disable this behaviour ...

    • Preferences > Other Settings > Save Actions
    • Untick Add final to field