Bug 377146

Summary: [rename] Rename method refactoring does not rename method in subclass if method in superclass uses generic type
Product: [Eclipse Project] JDT Reporter: Milos Gligoric <milos.gligoric>
Component: CoreAssignee: Sasikanth Bharadwaj <sasikanth.bharadwaj>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P5 CC: daniel_megert, deepakazad, gautier.desaintmartinlacaze, jarthana, markus.kell.r, nikolaymetchev
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/71357
Whiteboard: stalebug

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.