| Summary: | [use supertype] Inserts incorrect type argument when applied on a generic static method | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Milos Gligoric <milos.gligoric> | ||||
| Component: | UI | Assignee: | Samrat Dhillon <samrat.dhillon> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | manju656, samrat.dhillon | ||||
| Version: | 4.2.1 | Flags: | manju656:
review?
(manju656) |
||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
The issue is reproducible using Build ID : I20130115-1300. The refactoring results in compiler error. Created attachment 238624 [details] Fix and Test This problem can happen not only with static methods but also with instance methods. e.g. in the code snippet below interface I<T> { } class C11 { class C12<E> implements I<E> { } <A> C12<A> m() { return null; } } My fix is basically to use the type parameters that have been declared on the node where we are replacing the base type with super type. Another way to fix this would have been to add additional type parameters (type parameters of the super type) at the method level for the static methods and at the class level for instance methods. But this approach leads to too many type parameters and adds clutter. This contribution complies with http://www.eclipse.org/legal/CoO.php This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Steps to reproduce: 1. See the instructions in code below 2. The resulting code does not compile Build id: 20121114-2344 interface I<T> { } class C11 { // Invoke "Use Supertype Where Possible" on the class below and select // "I<T>" static class C12<E> implements I<E> { } static <A> C12<A> m() { return null; } }