The Inner Classes spec has NO restrictions in this area on the ".class"
expression syntax, this should just WORK.
cruella<104> cat I.java
interface I {
Class c = I.class;
}
cruella<105> javac I.java
I.java:1: Interface methods can't be native, static, synchronized, final, private, or protected : java.lang.Class class$(java.lang.String)
interface I {
^
I.java:2: Can't make static reference to method java.lang.Class class$(java.lang.String) in interface I.
Class c = I.class;
^
2 errors
---------------------------
There is no spec basis for this failure.
-kto
expression syntax, this should just WORK.
cruella<104> cat I.java
interface I {
Class c = I.class;
}
cruella<105> javac I.java
I.java:1: Interface methods can't be native, static, synchronized, final, private, or protected : java.lang.Class class$(java.lang.String)
interface I {
^
I.java:2: Can't make static reference to method java.lang.Class class$(java.lang.String) in interface I.
Class c = I.class;
^
2 errors
---------------------------
There is no spec basis for this failure.
-kto
- duplicates
-
JDK-4090582 Cannot use x.class in initializer in an interface.
-
- Closed
-
-
JDK-4055017 Class literals don't work in interfaces
-
- Closed
-