Community
Participate
Working Groups
The warning will be mistakenly output where the variable is being used but is references with this.variablename.
Can you please provide a testcase ?
Cannot reproduce. Following works fine: public class X { private int value; void foo() { System.out.println(this.value); class L { int pos; void bar() { System.out.println(this.pos); } } } }
Here you go... public class ThisVariable { private boolean isDbUpdate; public void setIsDbUpdate(String isDbUpdate) { this.isDbUpdate = Boolean.valueOf(isDbUpdate).booleanValue(); } }
Thanks, reproduced.
Actually, this is intended behavior. The warning tells you the variable is never *read* from. It is assigned, but the value is never consumed anywhere. It tells you that it is likely a useless field at the moment. Boolean.valueOf(isDbUpdate) only from reads the constructor argument, not from the field.
Added InitializationTest#test188