Bug 127078 - [compiler] inappropriate error location for QualifiedNameReferences
Summary: [compiler] inappropriate error location for QualifiedNameReferences
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-09 10:36 EST by Maxime Daniel CLA
Modified: 2006-02-15 07:42 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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