Local variable or parameter can be 'final'
Reports parameters or local variables that may have the final
modifier added to their declaration.
Example:
ArrayList<Integer> list = new ArrayList();
fill(list);
return list;
After the quick-fix is applied:
final ArrayList<Integer> list = new ArrayList();
fill(list);
return list;
Use the inspection's options to define whether parameters or local variables should be reported.
Inspection options
Option | Type | Default |
---|---|---|
Report local variables | Checkbox | true |
Report method parameters | Checkbox | true |
Report catch parameters | Checkbox | true |
Report foreach parameters | Checkbox | true |
Report variables which are implicitly final (multi-catch or try-with-resources parameters) | Checkbox | true |
Report pattern variables | Checkbox | true |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023