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

javac 1.7/1.8 rejects to compile code though javac 1.6 accepts the code

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      the code fails to compile
      {code}
      interface StubElement<T>{
          T getPsi();
      }

      abstract class StubElementBase<T> implements StubElement<T> {
          @Override
          public T getPsi() {
              return null;
          }
      }

      abstract class MyStubbedElement<T extends StubElementBase<?> & Runnable> {}

      {code}

      error message: Error:(14, 33) java: getPsi() in aa.StubElementBase cannot implement getPsi() in aa.StubElement
        return type capture#1 of ? is not compatible with capture#2 of ?

      BTW

      if we would omit Runnable in type parameter declaration, then the code would compile. Moreover if StubElementBase<T> would be an interface with default method, then the code also would compile.

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

      REGRESSION. Last worked in version 6u43

      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dlsmith Dan Smith
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: