FULL PRODUCT VERSION :
java version "1.8.0_20-ea"
Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b20)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b20, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows.
All
A DESCRIPTION OF THE PROBLEM :
interface T2 { int f = 0; }
interface T extends T2 { int f = 0; }
class X implements T {
int i = T.super.f;
}
The compiler compiles the code without any issues.
JLS 15.11.2. Accessing Superclass Members using super
"The form T.super.Identifier refers to the field named Identifier of the lexically enclosing instance corresponding to T, but with that instance viewed as an instance of the superclass of T."
The statement does not mention anything about Interfaces.
In my opinion the compiler should throw for T.super.f.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
interface T2 { int f = 0; }
interface T extends T2 { int f = 0; }
class X implements T {
int i = T.super.f;
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The compiler should throw for T.super.f.
ACTUAL -
The code compiles fine without any issues.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
interface T2 { int f = 0; }
interface T extends T2 { int f = 0; }
class X implements T {
int i = T.super.f;
}
---------- END SOURCE ----------