evaluation for bug: https://bugs.openjdk.java.net/browse/JDK-8059921

Alex Buckley alex.buckley at oracle.com
Thu Oct 23 00:24:27 UTC 2014

On 10/22/2014 2:30 PM, Vicente-Arturo Romero-Zaldivar wrote:
> I would like to know your opinion about the bug in the subject. The
> related code is:
> interface T2 { int f = 0; }
> interface T extends T2 { int f = 0; }
> class X  implements T {
>      int i = T.super.f;
> }
> The reporter considers that JLS 15.11.2 doesn't mention interfaces
> explicitly and that for this reason this is a bug. Should the spec be
> read more generally, thus including interfaces?

No. The code shouldn't compile.

The T.super.f construct is only for accessing fields of a lexically 
enclosing superclass. The goal is to allow access to instance variables 
which would otherwise be hidden. (It's also possible to access static 
variables too, but that's a side effect of how field access works 
generally.) This goal is not relevant to superinterfaces, as they have 
no instance variables to be hidden - you can always access their fields 
(static variables) via qualified names.


More information about the compiler-dev mailing list