Bug 78735 - IBinding#isEqualTo(..) fails with a field that hides another
Summary: IBinding#isEqualTo(..) fails with a field that hides another
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-16 10:24 EST by Markus Keller CLA
Modified: 2004-12-14 09:57 EST (History)
2 users (show)

See Also:


Attachments

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