Bug 561301 - [refactor] Move type to new file does not update static imports if type is nested enum
Summary: [refactor] Move type to new file does not update static imports if type is ne...
Status: CLOSED DUPLICATE of bug 493212
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.15   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-20 10:21 EDT by Lukas Eder CLA
Modified: 2020-03-20 11:18 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2020-03-20 10:21:10 EDT
Consider this valid Java code:

// -------------------------------------------
package com.example;

import static com.example.Container.E.A;

public class Container {
	E e = A;
	enum E { A, B }
}
// -------------------------------------------

I now want to move the nested enum type "E" to its own file using "Alt-Shift-T > Move Type to New File..."

I'm left with the following, wrong code:

// -------------------------------------------
package com.example;

import static com.example.Container.E.A;

public class Container {
	E e = A;
}
// -------------------------------------------

The static import is not updated to the expected new import:

// -------------------------------------------
import static com.example.E.A;
// -------------------------------------------
Comment 1 Lukas Eder CLA 2020-03-20 11:18:01 EDT
It seems, I have already reported this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=493212

*** This bug has been marked as a duplicate of bug 493212 ***