Bug 99608 - IMethodBinding#overrides returns false on overridden method
Summary: IMethodBinding#overrides returns false on overridden method
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-13 07:02 EDT by Tobias Widmer CLA
Modified: 2005-06-16 13:52 EDT (History)
1 user (show)

See Also:


Attachments
Philippe's patch (2.28 KB, patch)
2005-06-13 11:33 EDT, Jerome Lanneluc CLA
no flags Details | Diff
Regression test (2.17 KB, patch)
2005-06-13 11:36 EDT, Jerome Lanneluc CLA
no flags Details | Diff

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