Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8025494

javac inference - shadowing compile error

XMLWordPrintable

      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

            vromero Vicente Arturo Romero Zaldivar
            vromero Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: