[type-annos-observers] error: enclosing static nested class cannot be annotated ??

Srikanth S Adayapalam srikanth_sankaran at in.ibm.com
Sun Oct 6 23:46:45 PDT 2013


Hello !


I see that 8b108 rejects the following code.
I am trying to trace this behavior back to the
spec - with not clear cut success. Could you
help clarify the behavior ?

Thanks!
Srikanth.



// --
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target(ElementType.TYPE_USE)
@interface Illegal {
}
class Y {
        static class YY {
                class Z {
                        Z() {}
                }
        }
}
class X {
        Y.YY.Z foo2() {
                Y. at Illegal YY.Z z = null;  // illegal ???
                return z;
        }
}


More information about the type-annotations-spec-observers mailing list