Bug 7987

Summary: Field reference search should do lookup in 1.4 mode
Product: [Eclipse Project] JDT Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P1 CC: philippe_mulet
Version: 2.0   
Target Milestone: 2.0 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Jerome Lanneluc CLA 2002-01-22 06:10:58 EST
In 1.4 mode, the following test case will fail when searching to reference to 
A.x:

public class A {
  int x;
}

public class B extends A {
  void foo() {
    this.x++;
  }
}

In this case, the declaring class of the field refence binding will be B, and 
the match locator will not find the reference because it looks for A exactly.
Comment 1 Jerome Lanneluc CLA 2002-01-22 06:12:13 EST
2 solutions to this problem:
- the match locator does a lookup as it is done for method references
- the original binding is stored on the field ref and the match locator uses 
this original binding
Comment 2 Philipe Mulet CLA 2002-01-23 07:05:34 EST
This should not be necessary, I will keep the old binding as is, and rather 
introduce a distinct slot to hold onto the codegen binding.
Comment 3 Philipe Mulet CLA 2002-02-02 06:54:39 EST
Jerome, can you please double check that the search behaves ok in 1.4 mode 
(will need to manually toggle the compiler option since no UI for it yet - the 
option is "Compliance" which you'll need to set to "1.4" by default).

Comment 4 Jerome Lanneluc CLA 2002-02-03 10:34:11 EST
Search behaves ok in 1.4 mode, but in the above test case, the codegen binding 
has class A as the declaring class. Shouldn't it rather be B? (see 
JavaSearchTests.testFieldReference5())
Comment 5 Jerome Lanneluc CLA 2002-02-04 06:39:02 EST
Codegen binding is set only during code gen!
Closing.