Community
Participate
Working Groups
Build id: I20060208-0848 On the following test case: class X { class Y { int longMemberName; } static public void main (String args[]) { Y y; System.out.println(y.longMemberName); } } the correct error is reported, but its location is too long (matches y.longMemberName instead of y): System.out.println(y.longMemberName); ^^^^^^^^^^^^^^^^ The local variable y may not have been initialized This is the same for other errors involving qualified name references. The cause must be related to the fact that the ASTNode is a QualifiedNameReference, which location matches y.longMemberName, and that its location is used for the error message elaboration.
Fixed and released in HEAD. Regression tests in org.eclipse.jdt.core.tests.compiler.regression.LocalVariableTest.test008/009
The fix is in ProblemReporter, where an helper method has been added to better locate errors for local variable bindings. This method is not used for all errors that involve locals though. I modify null analysis related error methods to use the new location scheme (in HEAD).
Verified for 3.2 M5 using build I20060215-0010