Details

    • Type: Sub-task
    • Status: Closed
    • Priority: P4
    • Resolution: Delivered
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
    • Verification:
      Verified

      Description

      Javac was not in sync with [JLS 8 §15.12.1](https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.1), specifically:
       
      If the form is TypeName . super . [TypeArguments] Identifier, then:
      ...
      - Otherwise, TypeName denotes the interface to be searched, I.
       
      Let T be the type declaration immediately enclosing the method invocation. It
      is a compile-time error if I is not a direct superinterface of T, or if there exists some other direct superclass or direct superinterface of T, J, such that J is a subtype of I.

      So javac was not issuing a compiler error for cases like:
      ```
      interface I {
          default int f(){return 0;}
      }
       
      class J implements I {}
       
      class T extends J implements I {
          public int f() {
              return I.super.f();
          }
      }
      ```
      The compiler had some checks for method invocations of the form:

      `TypeName . super . [TypeArguments] Identifier`

      but there was one issue. If `TypeName` is an interface `I` and `T` is the type declaration immediately enclosing the method invocation, the compiler must issue a compile-time error if there exists some other direct superclass or superinterface of `T`, let's call it `J` such that `J` is a subtype of `I`, as in the example above.

        Attachments

          Activity

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              mtrudeau Michel Trudeau
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: