Bug 116833

Summary: IMethodBinding#isEqualTo(..) returns true for methods in anonymous classes with error in parent
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    
Version: 3.2   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-11-17 04:38:00 EST
I20051116-1332

class Test {
    void m() {
        error();
        new Cloneable() {
            void xx() {}
        };
        new Cloneable() {
            void xx() {}
        };
    }
}

The bindings for the two methods xx() in the anonymous inner classes are
#isEqualTo(..) each other if there's an error in the enclosing method.

The same problem occurs when the anonymous types cannot be resolved:
    void m() {
        new Runnable() {
            void xx() {}
        };
        new Runnable() {
            void xx() {}
        };
    }
Comment 1 Olivier Thomann CLA 2005-12-19 10:48:12 EST
When the method contains an error before the anonymous declaration, the constant pool name of both anonymous is null. This is why the two methods are considered equal. In this case, I will use the unique key to compare the two anonymous type binding.
Comment 2 Olivier Thomann CLA 2005-12-19 10:53:05 EST
Fixed and released in HEAD.
Regression test added in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2.test0627
Comment 3 Maxime Daniel CLA 2006-02-15 08:28:57 EST
Verified for 3.2 M5 using build I20060215-0010.