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

Unnecessary loader constraints produced when there are multiple defaults

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 10
    • 10
    • hotspot
    • None
    • b31

      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.

            hseigel Harold Seigel (Inactive)
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: