Bug 127078

Summary: [compiler] inappropriate error location for QualifiedNameReferences
Product: [Eclipse Project] JDT Reporter: Maxime Daniel <maxime_daniel>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Maxime Daniel CLA 2006-02-09 10:36:21 EST
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.
Comment 1 Olivier Thomann CLA 2006-02-09 22:55:12 EST
Fixed and released in HEAD.
Regression tests in org.eclipse.jdt.core.tests.compiler.regression.LocalVariableTest.test008/009
Comment 2 Maxime Daniel CLA 2006-02-10 04:11:49 EST
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).
Comment 3 David Audel CLA 2006-02-15 07:42:19 EST
Verified for 3.2 M5 using build I20060215-0010