Bug 50206 - Error range for unqualified access to instance field
Summary: Error range for unqualified access to instance field
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-19 07:52 EST by Frederic Fusier CLA
Modified: 2004-02-11 07:31 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 Frederic Fusier CLA 2004-01-19 07:52:04 EST
Let's consider following example:
public class X {
	String str;
}
public class Y {
	X local;
	void foo() {
		local = new X();
		local.str = "string";
	}

}

When I set compiler option "Unqualifed access to instance field" to Warning, I 
get following messages while compiling:
----------
1. WARNING in D:\usr\OTI\workspaces\dvpt\v30\current\_Bug\Y.java (at line 4)
	local = new X();
	^^^^^
Unqualified access to the field Y.local 
----------
----------
2. WARNING in D:\usr\OTI\workspaces\dvpt\v30\current\_Bug\Y.java (at line 5)
	local.str = "string";
	^^^^^^^^^
Unqualified access to the field Y.local 
----------
2 problems (2 warnings)

First warning is OK, but I would prefer to have:
2. WARNING in D:\usr\OTI\workspaces\dvpt\v30\current\_Bug\Y.java (at line 5)
	local.str = "string";
	^^^^^
Unqualified access to the field Y.local 
----------
for second warning message...
Comment 1 Frederic Fusier CLA 2004-01-19 07:53:17 EST
Similar to bug 48617...
Comment 2 Frederic Fusier CLA 2004-01-19 13:14:37 EST
Fixed.

Modify ProblemReporter.unqualifiedFieldAccess(NameReference,Field) method to 
set source range on first token when NameReference is a QualifiedNameReference.

No test cases added as NegativeTest.test401 already look at this kind of error.
Comment 3 David Audel CLA 2004-02-11 07:31:28 EST
Verified 3.0M7