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

javac is not inducing a notional interface if Object appears in an intersection type

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 10, 11
    • Fix Version/s: 11
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b13
    • Verification:
      Verified

      Description

      class JDK8148354 {
          interface I {}
          interface J { void foo(); }

          public void test() {
              Object o1 = (I & J) System::gc;
              Object o2 = (Object & J) System::gc; // error
              Object o3 = (Object & I & J) System::gc; // error
          }
      }

      javac believes that Object is not allowed here, but it is:
      - "An intersection type that induces a notional functional interface" is a functional interface type (JLS 9.8)
      - "If Ck is Object, a notional interface is induced" -- where Ck is derived by mapping each intersection component to its most specific superclass type and then choosing the most specific of these class types -- in these cases, that's Object (JLS 4.9)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vromero Vicente Arturo Romero Zaldivar
                Reporter:
                vromero Vicente Arturo Romero Zaldivar
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: