Bug 116833 - IMethodBinding#isEqualTo(..) returns true for methods in anonymous classes with error in parent
Summary: IMethodBinding#isEqualTo(..) returns true for methods in anonymous classes wi...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-17 04:38 EST by Markus Keller CLA
Modified: 2006-02-15 08:28 EST (History)
0 users

See Also:


Attachments

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