Community
Participate
Working Groups
Build 20040226 package org.eclipse.jdt.core.dom; class Test { public class Inner {} } public class Main { public static void main(String[] args) { Test t = new Test(); Test.Inner i = t.new Test.Inner(); // syntax error } } The compiler (1.4 compiler settings) reports a syntax error on the "new" token. I don't see what the problem is. If you delete "t.", the problem says that you need to provide qualification that provides an enclosing instance of Test.
This is expected behavior, you should have written: Test t = new Test(); Test.Inner i = t.new Inner(); 'Inner' is resolved in the context of the qualifying expresssion type (Test). Only references to static member types can be qualified, and then no enclosing instance is to be supplied: new Test.StaticInner().