Details
-
Bug
-
Resolution: Fixed
-
P4
-
8
-
b124
-
Verified
Description
Java 8 supports a new use of super:
interface I {
default int f(){return 0;}
}
class X implements I {
public int f() {
return I.super.f();
}
}
This is described in 15.12.1.
However, there is wording in 15.12.1 that says: Let T be the type declaration immediately enclosing the method invocation. It is a compile-time error if I is not a direct superinterface of T, or if there exists some other direct superclass or direct superinterface of T, J, such that J is a subtype of I.
That would seem to require an error on this case, because T has a superclass of J, which is a subtype of I.
interface I {
default int f(){return 0;}
}
class J implements I { }
class T extends J implements I {
public int f() {
return I.super.f();
}
}
interface I {
default int f(){return 0;}
}
class X implements I {
public int f() {
return I.super.f();
}
}
This is described in 15.12.1.
However, there is wording in 15.12.1 that says: Let T be the type declaration immediately enclosing the method invocation. It is a compile-time error if I is not a direct superinterface of T, or if there exists some other direct superclass or direct superinterface of T, J, such that J is a subtype of I.
That would seem to require an error on this case, because T has a superclass of J, which is a subtype of I.
interface I {
default int f(){return 0;}
}
class J implements I { }
class T extends J implements I {
public int f() {
return I.super.f();
}
}
Attachments
Issue Links
- relates to
-
JDK-8159530 recent compiler change results in compile error in JapaneseDate.java
- Closed