JDK-8025494 : javac inference - shadowing compile error
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2013-09-26
  • Updated: 2018-12-13
  • Resolved: 2018-12-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_minorResolved
Related Reports
Duplicate :  
Description
This program:

public class Tmp
{
    class S{}

    interface I<S, T extends S>{}

    class C implements I<C,C>{}
}

fails with errors:

Tmp.java:7: error: type argument Tmp.C is not within bounds of type-variable S
    class C implements I<C,C>{}
                         ^
  where S is a type-variable:
    S extends Object declared in interface I
Tmp.java:7: error: type argument Tmp.C is not within bounds of type-variable T
    class C implements I<C,C>{}
                           ^
  where T is a type-variable:
    T extends Tmp.S declared in interface I
2 errors

if you comment class S out it compiles just fine.

reported by Zhong Yu in compiler-dev list
Comments
This bug is presumably 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). Alex
04-11-2013