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

javac, incorrect shadowing of classes vs type parameters

    Details

    • Subcomponent:
    • Resolved In Build:
      b39
    • Verification:
      Verified

      Backports

        Description

        The following snippet compiles with javac7, but not javac8-b128.

        ===
        class Test {
          class T<E> {}
          abstract class One<E> {
            abstract E foo();
          }
          abstract class Two<T> extends One<T> {
            abstract T foo();
          }
        }
        ===

        error: foo() in Test.Two cannot override foo() in Test.One
            abstract T foo();
                       ^
          return type T is not compatible with Test.T
          where T,E are type-variables:
            T extends Object declared in class Test.Two
            E extends Object declared in class Test.One


        Type parameter T should be shadowing the inner class Test.T

        reported in compiler-dev: http://mail.openjdk.java.net/pipermail/compiler-dev/2014-February/008515.html

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  emc Eric Mccorkle
                  Reporter:
                  vromero Vicente Arturo Romero Zaldivar
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: