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

JSR292: AME instead of IAE when calling a method

XMLWordPrintable

        Pseudo code:
        interface I { void m() default {} }

        class C implements I {
          private void m() {}
        }

        I o = new C(); o.m();

        Observed behavior:
        invokeinterface: IAE
        MH.invoke* / indy: NPE

        For MH.invokeExact case bytecode (Test1_I_C_m.class) is the following:
                 0: ldc #19 // MethodHandle invokeinterface I.m:()V
                 2: new #21 // class C
                 5: dup
                 6: invokespecial #22 // Method C."<init>":()V
                 9: astore_1
                10: aload_1
                11: invokevirtual #28 // Method java/lang/invoke/MethodHandle.invokeExact:(LI;)V

        NPE is thrown on bci=11 (MH.invokeExact).

        Test case is attached.

        How to run:
          $ java Test

              drchase David Chase (Inactive)
              vlivanov Vladimir Ivanov
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: