Bug 78735

Summary: IBinding#isEqualTo(..) fails with a field that hides another
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dirk_baeumer, martinae
Version: 3.1   
Target Milestone: 3.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2004-11-16 10:24:22 EST
I200411111200 + jdt.ui, jdt.core (v522), etc. from HEAD :

The the inner 'field' hides the outer one, but IBinding#isEqualTo(..) returns
true when comparing the two:

public class TestThisExpressionInner {
	int field;

	class Inner {
		int field;
		public void foo() {
			field= 10;
			TestThisExpressionInner.this.field= 11;
		}
	}
	
	public void foo() {
		field= 10;
	}	
}
Comment 1 Markus Keller CLA 2004-11-16 11:12:22 EST
A simpler example:
Bindings for A.field and I.field are considered isEqualTo(..) each other:

class A implements I {
    public static final int field= 1;
}
interface I {
    int field= 1000;
}

Also doesn't work when comparing methods m(){} instead of fields.
Comment 2 Olivier Thomann CLA 2004-11-16 15:16:38 EST
Fixed and released in HEAD.
Regression tests added.
ASTConverterTestAST3_2.test0574 and test0575.
Comment 3 Jerome Lanneluc CLA 2004-12-14 09:57:31 EST
Verified (in I200412140010) that the first test ensures that the 2 fields are
not equal, and that the second test ensures that the 2 methods are not equal.