Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 397157

Summary: [use supertype] Refactoring adds unwanted package qualification for nested type
Product: [Eclipse Project] JDT Reporter: Milos Gligoric <milos.gligoric>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P5 CC: Jesse.Weinstein, manju656, markus.kell.r
Version: 4.2.1   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard: stalebug
Attachments:
Description Flags
Minimal project to verify the problem none

Description Milos Gligoric CLA 2012-12-25 23:58:01 EST
Steps to reproduce:
1. See the instructions in code below
2. The resulting code does not compile

Build id: 20121114-2344

class C1 {
    // Invoke "Use Supertype Where Possible" on the class below
    static class I1<T> extends C2.I1<Object, T> {
    }

    <T> I1<T> m() {
        return null;
    }
}

class C2 {
    static class I1<T1, T2> {
    }
}
Comment 1 Martin Mathew CLA 2013-01-24 01:04:37 EST
Tried to reproduce the bug using Build ID : I20130115-1300. The refactoring does not result in compiler error.

The bug is reproducible using Build ID : I20121009-0800.

Looks like this issue is resolved in the latest builds. Milos can you confirm whether you are able to reproduce the bug in the latest builds?
Comment 2 Milos Gligoric CLA 2013-01-27 21:07:36 EST
Hi Manju,

Thanks for checking the report.  In the latest build that I have (20121220-1030) the resulting code is correct.  However, note that the package name (usesupertypewherepossible.C2.I1) is not necessary.


public class UseSupertypeWherePossibleBug397157 {
}

class C1 {
    // Invoke "Use Supertype Where Possible" on the class below
    static class I1<T> extends C2.I1<Object, T> {
    }

    <T> usesupertypewherepossible.C2.I1<Object, T> m() {
        return null;
    }
}

class C2 {
    static class I1<T1, T2> {
    }
}
Comment 3 Martin Mathew CLA 2013-01-28 05:43:51 EST
The originally reported bug is no more valid. Modifying the bug to track the "Use Supertype where possible" refactoring issue which inserts an unwanted package qualification to the refactored code.
Comment 4 Markus Keller CLA 2013-01-28 06:19:02 EST
Complete example for the new bug (unnecessary type parameters removed):

package usesupertypewherepossible;

class C1 {
    // Invoke "Use Supertype Where Possible" on the class below
    static class I1 extends C2.I1 {
    }

    I1 m() { // becomes usesupertypewherepossible.C2.I1
        return null;
    }
}

class C2 {
    static class I1 {
    }
}
Comment 5 Jesse Weinstein CLA 2013-02-11 18:09:49 EST
Created attachment 226888 [details]
Minimal project to verify the problem

Verified with eclipse-SDK-N20130210-2000-win32, for what it's worth. Attachment is a minimal project, to facilitate further verification.
Comment 6 Eclipse Genie CLA 2020-02-20 14:05: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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.