Massively refactor – how to add final keyword to Java method argument

You can use IntelliJ’s inspections mechanism for this:

  1. Navigate to Analyze->Run Inspection by Name
  2. Search for the “Local variable or parameter can be final” warning
  3. Make sure that “Report method parameters” is the only option checked.
  4. Select the root of the tree (it should read Local variable or parameter can be final”
  5. Click ALT+ENTER and select “make final”. This should add the final modifier in all the missing places.

Once you’ve done this, you may want to enable this inspection in your IDE so it warns you about making further mistakes:

  1. Navigate to File->Settings->Editor->Inspections
  2. Search for the “Local variable or parameter can be final” warning
  3. Make sure that “Report method parameters” is the only option checked.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)