While it is technically correct to assign to parameters from within method bodies, doing so before the parameter value is read is likely a bug.
Instead, initial values of parameters, caught exceptions, and foreach parameters should be, if not treated as final
, then at least read
before reassignment.
Noncompliant code example
public void doTheThing(String str, int i, List<String> strings) {
str = Integer.toString(i); // Noncompliant
for (String s : strings) {
s = "hello world"; // Noncompliant
}
}