Is this a bug?

Alex Buckley alex.buckley at
Wed Sep 25 11:04:59 PDT 2013

It's a bug. Presumably this is related to JDK-7118412.

- By JLS 6.3, the scope of the class S is the body of class Tmp, 
including the declaration of interface I.

- By JLS 6.3, the scope of the type parameter S is the type parameter 
section of I and the body of I.

- The type parameter S is a real declaration of a type, so by JLS 6.4.1 
it shadows the declaration of class S throughout the type parameter 
section of I (and the body of I).


On 9/24/2013 7:17 PM, Zhong Yu wrote:
> This program does not compile (jdk8 build 106)
> public class Tmp
> {
>      class S{}
>      interface I<S, T extends S>{}
>      class C implements I<C,C>{}
> }
> Apparently, javac thinks the bound of T is the class S, not the type variable S.
> I'm not sure if this is correct - shouldn't type variable S shadow
> class S inside <>?
> Thanks,
> Zhong Yu

More information about the compiler-dev mailing list