Bug 493212

Summary: [refactor] Move type to new file doesn't correctly alter static imported references
Product: [Eclipse Project] JDT Reporter: Lukas Eder <lukas.eder>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: REOPENED --- QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, jjohnstn
Version: 4.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Lukas Eder CLA 2016-05-09 04:46:29 EDT
I have the following annotation:


---------------------------------------------
package test;

import static test.Annotation.E.X;

public @interface Annotation {

    E e() default X;

    enum E {
        X, Y, Z;
    }
}

---------------------------------------------

I now choose to refactor -> move type to new file on the enum E. This produces the following invalid code, as the static import is left untouched:

---------------------------------------------
package test;

import static test.Annotation.E.X;

public @interface Annotation {

    E e() default X;
}
---------------------------------------------
package test;

public enum E {
    X, Y, Z;
}
---------------------------------------------

The expected output is:

---------------------------------------------
package test;

import static test.E.X; // Fix here

public @interface Annotation {

    E e() default X;
}
---------------------------------------------
package test;

public enum E {
    X, Y, Z;
}
---------------------------------------------
Comment 1 Jay Arthanareeswaran CLA 2016-05-11 06:49:21 EDT
This most likely belongs in the UI. Please move back if this is a problem in rewrite.
Comment 2 Eclipse Genie CLA 2020-02-22 07:13:49 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.
Comment 3 Lukas Eder CLA 2020-03-20 11:18:01 EDT
*** Bug 561301 has been marked as a duplicate of this bug. ***
Comment 4 Lukas Eder CLA 2020-03-20 11:18:36 EDT
The issue still persists, see also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=561301
Comment 5 Eclipse Genie CLA 2022-03-11 03:57:04 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.
Comment 6 Jeff Johnston CLA 2022-03-11 15:52:03 EST
Bug still occurs in 4.23
Comment 7 Eclipse Genie CLA 2024-03-02 13:57:13 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.