Direct instantiation of inner class without enclosing reference in static inner class

Issue #95 resolved
Jesper Öqvist created an issue

JastAddJ 7.1.1-271-g22d48cf Java SE 7

It should not be possible to create an instance of an inner class in a static class without an enclosing class instance.

Test case:

// Can not, in a static class, directly instantiate inner class of enclosing type.
// .result=COMPILE_FAIL
class Test {
        static class C {
                D d = new D();// error
        }
        class D {
        }
}

Comments (1)

  1. Log in to comment