Summary: | [compiler] "Variable never used" is reported if variable is only referenced with this.variable | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | MG <java97301> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | RESOLVED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 3.2 | ||
Target Milestone: | 3.2 M6 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
MG
2006-03-02 18:37:56 EST
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 |