Bug 377146 - [rename] Rename method refactoring does not rename method in subclass if method in superclass uses generic type
Summary: [rename] Rename method refactoring does not rename method in subclass if meth...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: PC Linux
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Sasikanth Bharadwaj CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-19 03:12 EDT by Milos Gligoric CLA
Modified: 2023-02-24 15:17 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milos Gligoric CLA 2012-04-19 03:12:00 EDT
Build Identifier: Version: 3.7.2 Build id: M20120208-0800

Rename method refactoring does not rename method in subclass if method in superclass uses generic type.

Reproducible: Always

Steps to Reproduce:
1. In the example below rename method m to m0
2. Method in subclass will not be renamed
3. There is a compilation error (without @Override the error would not be caught)

abstract class C<T> {
    // RENAME THIS METHOD (this method will be renamed)
    protected abstract boolean m(T a);
}

public abstract class RenameMethod<T extends Object> extends C<T> {
    // RENAME THIS METHOD (this method will not be renamed)
    @Override
    protected abstract boolean m(Object a);
}
Comment 1 Markus Keller CLA 2012-04-19 06:42:49 EDT
The example is quite weird. RenameMethod#m(Object) doesn't cleanly override C#m(T), but it overrides the erased method C#m(Object).

The fix is to change RenameMethod#m(Object) to RenameMethod#m(T).

I'll check if we should raise a warning in this case.

Filed bug 377169 for a compiler problem that shows up if you flesh out the example.
Comment 2 Deepak Azad CLA 2012-12-01 00:30:05 EST
See also bug 395349.
Comment 3 Eclipse Genie CLA 2016-04-25 13:27:22 EDT
New Gerrit change created: https://git.eclipse.org/r/71357
Comment 4 Nikolay Metchev CLA 2016-04-26 04:55:30 EDT
Please note the fix for this bug that I submitted is in jdt.core and not in jdt.ui.
Comment 5 Sasikanth Bharadwaj CLA 2017-05-15 05:05:04 EDT
Move to 4.8
Comment 6 Manoj N Palat CLA 2018-08-16 00:30:12 EDT
Bulk move out of 4.9
Comment 7 Eclipse Genie CLA 2020-08-15 15:00:38 EDT
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.
Comment 8 Eclipse Genie CLA 2023-02-24 15:17:47 EST
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.