Community
Participate
Working Groups
v228, [public class Outer { class Inner extends Outer { } public static void main(String[] args) { class Local extends Inner { } } }] Compiling this class with javac 1.3.1 or 1.4 reports: Outer.java:5: no enclosing instance of type Outer is in scope class Local extends Inner { ^ 1 error We compile it fine and generate three .class files. Need to investigate which one is the correct behavior. See also http://www-124.ibm.com/developerworks/bugs/?func=detailbug&bug_id=372&group_id=1 0
Our behavior seems appropriate given the local class doesn't need any enclosing information (until it uses anything from the enclosing scopes). Inner-emulation is supposed to be lazily requesting access to enclosing elements, and Javac is simply asking too much by default, I had already noticed it was always requesting the enclosing instance by default. Will not change unless this is escaladated due to a JCK compliance issue.
Closing, got fixed along with various innerclass adjustments. -> No enclosing instance of type Outer is accessible to invoke the super constructor. Must define a constructor and explicitly qualify its super constructor invocation with an instance of Outer (e.g. x.super() where x is an instance of Outer).
Should remove later resolution
Closing