Virtual Extension Method bug report

Paul Sandoz paul.sandoz at oracle.com
Wed Nov 20 02:32:30 PST 2013


Hi Craig,

Thanks. I can reproduce. This looks like a VM method invocation issue.

If you comment out abstract method on AbstractMethod it works.

In either case with the method commented out or not java creates the following for ConcreteCallsSuper:

Constant pool:
...
   #5 = InterfaceMethodref #10.#33        //  Test$EmptyInterface.method:()V
...
  public void method();
    flags: ACC_PUBLIC
    Code:
      stack=2, locals=1, args_size=1
         0: getstatic     #2                  // Field java/lang/System.out:Ljava/io/PrintStream;
         3: ldc           #3                  // String example.ConcreteCallsSuper.method
         5: invokevirtual #4                  // Method java/io/PrintStream.println:(Ljava/lang/String;)V
         8: aload_0       
         9: invokespecial #5                  // InterfaceMethod Test$EmptyInterface.method:()V
        12: return        

Which i believe is correct (and i think may have recently been fixed).

I tested with a later version of hotspot [*] yet to be integrated into the jdk8 and tl repos and it worked. So a fix should be on its way to a later jdk8 ea build, dunno which one though.

Paul.

[*] If you want to verify for yourself clone http://hg.openjdk.java.net/hsx/hotspot-rt and build

On Nov 20, 2013, at 5:27 AM, Craig P. Motlin <cmotlin at gmail.com> wrote:

> I've been testing jdk-8-ea-bin-b115-windows-x64-07_nov_2013 and I ran into
> a problem. My program compiles and I get an AbstractMethodError when I call
> a virtual extension method using the SuperClass.super.method() syntax, when
> the method body is defined higher up than SuperClass.
> 
> Exception in thread "main" java.lang.AbstractMethodError:
> example.EmptyInterface.method()V
> at example.ConcreteCallsSuper.method(ConcreteCallsSuper.java:9)
> at example.ConcreteCallsSuper.main(ConcreteCallsSuper.java:14)
> 
> Here's the code. All three interfaces seem important.
> 
> public interface AbstractMethod
> {
>    void method();
> }
> 
> public interface VirtualExtensionMethod extends AbstractMethod
> {
>    @Override
>    default void method()
>    {
>        System.out.println("example.VirtualExtensionMethod.method");
>    }
> }
> 
> public interface EmptyInterface extends VirtualExtensionMethod
> {
> }
> 
> public class ConcreteCallsSuper implements EmptyInterface
> {
>    @Override
>    public void method()
>    {
>        System.out.println("example.ConcreteCallsSuper.method");
>        EmptyInterface.super.method();
>    }
> 
>    public static void main(String[] args)
>    {
>        new ConcreteCallsSuper().method();
>    }
> }
> 



More information about the lambda-dev mailing list