Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 1.9 KB

README.md

File metadata and controls

62 lines (42 loc) · 1.9 KB

final-obsession

Build Version Downloads

This plugin adds the final modifier to each possible local parameter and variable when you save a Java class. Fields are left untouched.

Before:

class Foo {
  int couldBeFinalField = 0;
  
  void bar(int canBeFinalParameter) {
    int canBeFinalVariable = 1;
  }
}

After:

class Foo {
  int couldBeFinalField = 0;
  
  void bar(final int canBeFinalParameter) {
           ^^^^^
    final int canBeFinalVariable = 1;
    ^^^^^
  }
}

The plugin is meant to be used as quickly as possible. It has no configuration nor UI. It's a dynamic plugin, so you can install and uninstall it without restarting IntelliJ.

Installation

You can find this plugin in the marketplace.

Q&A

Why?

Why not? Adding final wherever possible is a convention in my team. The Save Actions Plugin is archived and didn't work correctly on newer versions of the IDE. IntelliJ's new "Actions on Save" tool requires too much configuration compared to the aforementioned plugin. I wanted something simple that just works. I also wanted to learn how to write a formatting plugin, so here we are.

Thanks to


Plugin based on the IntelliJ Platform Plugin Template.