Community
Participate
Working Groups
/* this warning is right? */ final int a; System.out.println(a=1); // compiler sais cannot read 'a'
Cannot reproduce either with latest 3.0 or 2.1.3.
I am sorry, I forgot to write a compiler option. # intact variable which is not read to WARNING
Please explain what you see and what you would like to see.
Pls also mention the Eclipse build number you are using, then reopen.
Since it is a left side value, I think that it is read. Thanks. /** A warnig that I see */ class X { { int a; // !The locla valiable a is never read System.out.println(a = 1); } } eclipse-SDK-2.1.3-win32.zip Java Compiler Unused local valiables (ie. never read): Warning (defalut: Ignore)
Build id: 200403101828
The variable itself is never read under this scenario, since we duplicate the assigned value (1) on the execution stack. We don't store the variable, then repush it, it would be pretty inefficient compared to copying simply the value on stack before assigning it. So to be short, the diagnostic is accurate, we indeed do not read the value from the variable.
I understand well.