Bug 182459 - [compiler] Inconsistent error range for unresolved field
Summary: [compiler] Inconsistent error range for unresolved field
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M7   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 182319 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-04-15 10:43 EDT by Martin Aeschlimann CLA
Modified: 2010-03-18 04:55 EDT (History)
5 users (show)

See Also:


Attachments
Proposed fix + updated regression tests (11.89 KB, patch)
2010-03-15 14:17 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2007-04-15 10:43:46 EDT
20070415

In the following code:
p/X.java -----------------
package p;
public class X {
   static int NEW_FIELD;
}

q/Y.java -----------------
package q;
import p.X;
public class Y {
  void foo() {
     int i = X.OLD_FIELD;
  }
  void bar() {
     int j = X.OLD_FIELD;
  }
}

'OLD_FIELD' can not be resolved. The error range is 'X.OLD_FIELD', but should be only 'OLD_FIELD'.

If you change to
public class Y {
  void foo() {
     int i = X.OLD_FIELD();
  }
  void bar() {
     int j = X.OLD_FIELD();
  }
}
then the error range is only 'OLD_FIELD()'
Comment 1 Ayushman Jain CLA 2010-03-09 06:51:35 EST
The error message I get is X.OLD_FIELD cannot be resolved to a variable, instead of OLD_FIELD cannot be resolved, as reported here. In view of this error message, I believe that the error range is consistent.

Srikanth, what do you think? Does the error range need any change here?
Comment 2 Srikanth Sankaran CLA 2010-03-10 02:24:34 EST
(In reply to comment #1)
> The error message I get is X.OLD_FIELD cannot be resolved to a variable,
> instead of OLD_FIELD cannot be resolved, as reported here. In view of this
> error message, I believe that the error range is consistent.
> 
> Srikanth, what do you think? Does the error range need any change here?

This seems to be have been the behavior at least since 3.3.2.
I agree that current message and range are appropriate.
This defect could be closed with no change.
Comment 3 Srikanth Sankaran CLA 2010-03-10 02:25:11 EST
Verified for 3.6M6.
Comment 4 Dani Megert CLA 2010-03-15 11:49:51 EDT
Reopening, given we just fixed bug 303830: we should align this one with it and it will also help us fix bug 182319.
Comment 5 Olivier Thomann CLA 2010-03-15 14:17:52 EDT
Created attachment 162094 [details]
Proposed fix + updated regression tests
Comment 6 Olivier Thomann CLA 2010-03-15 14:19:26 EDT
Ayushman, please review.
Comment 7 Frederic Fusier CLA 2010-03-16 10:34:35 EDT
(In reply to comment #5)
> Created an attachment (id=162094) [details]
> Proposed fix + updated regression tests

Patch looks good to me.
Comment 8 Ayushman Jain CLA 2010-03-17 02:51:41 EDT
(In reply to comment #7)
> Patch looks good to me.

Yup, I agree with Frederic.
Comment 9 Olivier Thomann CLA 2010-03-17 12:13:32 EDT
Released for 3.6M7.
Updated existing regression tests.
Comment 10 Dani Megert CLA 2010-03-18 04:55:24 EDT
Verified in HEAD.
Comment 11 Dani Megert CLA 2010-03-18 04:55:48 EDT
*** Bug 182319 has been marked as a duplicate of this bug. ***