JDK-8032010 : Attempt to resolve abstract method in concrete class fails with AbstractMethodError
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs25,emb-8u26,8,9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-01-16
  • Updated: 2014-10-04
  • Resolved: 2014-02-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20 b03Fixed 9Fixed
Related Reports
Relates :  
Description
Consider the following case:
  class T1 { public void m() {} }
  class T2 { public abstract void m(); }
  class T3 { public void m() {} }

Call site: T3 { invokevirtual T2.m()V T3 } 

NB: class T2 isn't marked as abstract. 

VM: AbstractMethodError: p1.T2.m()V 
JVMS: T3.m() should be invoked 

The following check during method resolution is removed in JVMS-8 [1]:
JVMS-5.4.3.3. Method Resolution
"If method lookup succeeds and the method is abstract, but C is not abstract, method resolution throws an AbstractMethodError." 

ILW = HLM = P3

I = H = JVMS-8 violation; severely affects testing of default methods
L = L = javac doesn't generate such bytecode
W = M = add ACC_ABSTRACT to class' attributes 

[1] http://cr.openjdk.java.net/~dlsmith/jsr335-0.9.1/J.html
Comments
I could reproduce the bug with latest jdk8 build. The exception is as follows: Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at test.TestConcreteClassWithAbstractMethod.main(TestConcreteClassWithAbstractMethod.java:54) Caused by: java.lang.AbstractMethodError: p1.T2.m()I at p1.T3.test(Unknown Source) ... 5 more As suggested by Vladimir, if the ACC_ABSTRACT attribute is added to the class p1.T2 by changing line #92 to the following, the bug isn't reproducible. cw.visit(52, ACC_PUBLIC | ACC_SUPER | ACC_ABSTRACT, "p1/T2", null, "p1/T1", null);
18-01-2014