Bug 99608

Summary: IMethodBinding#overrides returns false on overridden method
Product: [Eclipse Project] JDT Reporter: Tobias Widmer <tobias_widmer>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dirk_baeumer
Version: 3.1   
Target Milestone: 3.1 RC3   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Philippe's patch
none
Regression test none

Description Tobias Widmer CLA 2005-06-13 07:02:10 EDT
3.1 RC2

Steps to reproduce:
- Consider following snippet

class Top<E> {
    void add(E[] e) {}
}
class Sub extends Top<String> {
    void add(String... s) {}
}

- Open AST View and compare the two bindings in the comparison tray
-> Method binding in Sub does not override binding in Top
Comment 1 Philipe Mulet CLA 2005-06-13 09:44:00 EDT
Interestingly, the compiler accepts:
class Top<E> {
    void add(E[] e) {}
}
class Sub extends Top<String> {
	@Override
    void add(String... s) {}
}

which indicates that the AccOverriding bit got properly set.
(if not, it would complain that method doesn't override as expected)
Comment 2 Jerome Lanneluc CLA 2005-06-13 10:01:20 EDT
We fisrt check if the declaring classes are compatible (isCompatibleWith(...))
which return false in this case. Should we take the erasures of the declaring
classes ?
Comment 3 Jerome Lanneluc CLA 2005-06-13 10:23:27 EDT
Actually there is a helper in the compiler for that:
findSuperTypeWithSameErasure(...)
Comment 4 Philipe Mulet CLA 2005-06-13 10:26:50 EDT
+1 for RC3.

Reviewed fix with Jerome (need to use supertype with same erasure, and use
substituted super method when activating method verifier).

Dirk - pls cast your vote.
Comment 5 Jerome Lanneluc CLA 2005-06-13 10:38:22 EDT
Adding Dirk to CC to cast a vote
Comment 6 Jerome Lanneluc CLA 2005-06-13 11:33:01 EDT
Created attachment 22939 [details]
Philippe's patch
Comment 7 Jerome Lanneluc CLA 2005-06-13 11:36:13 EDT
Created attachment 22940 [details]
Regression test
Comment 8 Dirk Baeumer CLA 2005-06-13 17:47:31 EDT
+1.
Comment 9 Jerome Lanneluc CLA 2005-06-14 06:24:49 EDT
Released fix and regression test
Comment 10 Olivier Thomann CLA 2005-06-16 13:52:21 EDT
Verified using N20050616-0010 + JDT/Core HEAD