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

Bug 294204

Summary: [move member type] compile error when the member type inherits non-static member type of the enclosing class
Product: [Eclipse Project] JDT Reporter: fictivy
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P5 CC: markus.kell.r
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard: stalebug

Description fictivy CLA 2009-11-04 09:57:03 EST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14
Build Identifier: M20090211-1700

Converting InnerSub to a top-level class in the following:

public class Outer {
	class InnerSuper {}
	class InnerSub extends InnerSuper { }
}

Results in a top-level InnerSub which does not declare a constructor, but has no access to an enclosing class instance, leading to a compilation error.
Instead a constructor should be generated (or existing constructors modified) thus:

class InnerSub extends InnerSuper { 
	public InnerSub (Outer outer) {
		outer.super();
	}
}

(A constructor with this signature is already generated if an "Enclosing instance field name" is supplied in the refactoring dialog box, but in any case the outer.super() call is missing)

This applies also when the converted type inherits a member type of a superclass of the enclosing class.

Reproducible: Always
Comment 1 Eclipse Genie CLA 2019-09-10 18:45:35 EDT
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.