Community
Participate
Working Groups
Given this class: package p; public class C { protected class I1 { } protected class I2 extends I1 { protected void foo() { } } void test(I2 i) { i.foo(); } } When pulling up foo() to I1 and enabling "use the destination type where possible" the change in test(..) creates a bogus import of the inner class I1. Result is: package p; import p.C.I1; // BUG public class C { protected class I1 { protected void foo() { } } protected class I2 extends I1 { } void test(I1 i) { i.foo(); } } The bug seems to originate from the fact that SuperTypeRefactoringProcessor.createCorrespondingNode(CompilationUnitRewrite, TType) calls ImportRewrite.addImportFromSignature(String,AST) with no proper ImportRewriteContext.
Created attachment 223371 [details] proposed patch could it be as simple as this? The patch fixes the immediate issue, not sure if more needs to be done for a full solution?
Yes, it's really as simple as that, thanks for the patch. Fixed with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=686e984f6a987f453770fc1ff7ed856e27238d93
(In reply to comment #2) > Fixed with > http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/ > ?id=686e984f6a987f453770fc1ff7ed856e27238d93 Thanks