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

Unnecessary loader constraints produced when there are multiple defaults

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 10
    • Fix Version/s: 10
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b31

      Description

      In the following scenario, Hotspot produces a loader constraint ("Foo" must be the same for loaders of I and J), even though it's not needed: neither default method can be selected for instances of C, due to the conflict.

      interface I { default Foo m() { return null; } }
      interface J {default Foo m() { return null; } }
      class C implements I, J {}

      A test is attached. To reproduce:
      - Compile *.java
      - Uncomment the method declaration in J.java
      - Compile J.java
      - java Test

      Expected: no error
      Actual: loader constraint violation

      The specification for these constraints is missing, see JDK-8078636. Per the comments, the proposed rule is that preparation should simulate method selection and generate loader constraints iff selection would succeed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hseigel Harold Seigel
                Reporter:
                dlsmith Dan Smith
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: