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

Bug 432689

Summary: [refactoring] Move type to new file makes self-reference in type arguments nested
Product: [Eclipse Project] JDT Reporter: Timo Kinnunen <timo.kinnunen>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta
Version: 4.4   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug
Bug Depends on: 100546    
Bug Blocks:    

Description Timo Kinnunen CLA 2014-04-13 04:11:33 EDT
When using Move type to new file refactoring and the nested class being moved is generic with a self-referential type argument, then the resulting class has received a static reference to its old nested type. To reproduce using this code:

package move.nested.type.to.file;
import java.util.function.Supplier;

public class IOStreamer<T> implements Supplier<IOStreamer<T>> {
	public static class LongIOStreamer implements Supplier<LongIOStreamer> {
		@Override
		public LongIOStreamer get() {
			;
			return null;
		}
	}
	@Override
	public IOStreamer<T> get() {
		;
		return null;
	}
}

Move the LongIOStreamer to a new file. The result looks like this:

public class LongIOStreamer implements Supplier<IOStreamer.LongIOStreamer> {
	@Override
	public IOStreamer.LongIOStreamer get() {
		;
		return null;
	}
}

This doesn't compile any more. Tested with Eclipse SDK

Version: Luna (4.4)
Build id: I20140408-1645

and JDT Core & UI built from HEAD within the last few days.
Comment 1 Noopur Gupta CLA 2014-04-14 08:15:42 EDT
Another simple example (Move 'B' to a new file):
-----------------------------------------------
package test.bugzilla;

public class A<T> {
	public static class B {
		public B get() {
			return null;
		}
	}
}
-----------------------------------------------

The checks are present at: "MoveInnerToTopRefactoring.TypeReferenceQualifier.visit(SimpleType node)", which fail as the binding keys are not equal (bug 432724).
Comment 2 Eclipse Genie CLA 2020-02-05 16:37:06 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.