The compiler accepts the following:
package p1;
import p2.X;
class D extends X {
X.M m2 = new X().new M();
}
package p2;
public class X {
static public class M {
public M(){}
}
}
this contradicts the specification, which requires that the class being
instantiated via a qualified class instance creation expression be an
inner class.
gilad.bracha@eng 1999-11-30
package p1;
import p2.X;
class D extends X {
X.M m2 = new X().new M();
}
package p2;
public class X {
static public class M {
public M(){}
}
}
this contradicts the specification, which requires that the class being
instantiated via a qualified class instance creation expression be an
inner class.
gilad.bracha@eng 1999-11-30
- duplicates
-
JDK-4137335 qualified new syntax is not applicable for static inner classes
- Closed