Hi,
I miss a rule in SonarJava which checks if a local field can be final. I know this rule from the Intellij IDEA (Declaration can have final modifier inspection).
Is there a reason why this rule does not exist? If not, it would be great if you could implement this rule.
Regards
Marcel
{ private List<String> collection = new ArrayList<>(); // should be final private Collection<String> items; // should be final
public App(Collection<String> items) { this.items = items; }
public void foo() { collection.add("Foo"); }
public void bar() { collection.stream().forEach(System.out::println); items.stream().forEach(System.out::println); }}