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

invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults

XMLWordPrintable

    • b120
    • b11
    • Not verified

        Consider the following case:
           public interface I1 { default public void m() {}}
           public interface I2 { default public void m() {}}
           public class T3 implements I1, I2 { public static void m() {}}
           public class T4 extends T3 {}

        Call site: invokestatic T4.m

        JVMS: T3.m is invoked.
        JVM behavior: IncompatibleClassChangeError: Expected static method p1.T4.m()I

        According to JVMS, T4.m resolves to T3.m which should be invoked.

        Test case is attached.

        I1.m, I2.m & T3.m are crucial to get the bug to occur.

        The most probable culprit is 8026066 (the test starts failing with 8b120).

        ILW = HLH = P2
        I = H = error instead of successful method invocation
        L = L = conflicting default methods + static method are required; javac won't compile such hierarchy
        W = H = no workaround

              lfoltan Lois Foltan
              vlivanov Vladimir Ivanov
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: