Bug 469889

Summary: java.lang.AbstractMethodError calling default method in Java 1.8
Product: [Tools] AspectJ Reporter: Hugh Eaves <hugh>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aclement
Version: 1.8.6   
Target Milestone: 1.8.7   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Code to reproduce error none

Description Hugh Eaves CLA 2015-06-10 19:42:34 EDT
Created attachment 254317 [details]
Code to reproduce error

The attached Java 1.8 code results in the following exception after compilation with ajc and executing the "Main" class:

Exception in thread "main" java.lang.AbstractMethodError: Method BImpl.getValue()Ljava/lang/Object; is abstract
	at BImpl.getValue(BImpl.java)
	at Main.main(Main.java:9)


Steps to reproduce:
export CLASSPATH=/opt/aspectj1.8/lib/aspectjrt.jar:.
/opt/aspectj1.8/bin/ajc -1.8 *.java
java Main

Result:
Exception in thread "main" java.lang.AbstractMethodError: Method BImpl.getValue()Ljava/lang/Object; is abstract
        at BImpl.getValue(BImpl.java)
        at Main.main(Main.java:9)
Comment 1 Hugh Eaves CLA 2015-06-10 19:45:18 EDT
I guess I should mention that the exact same code compiled with javac executes without throwing the exception. :)
Comment 2 Andrew Clement CLA 2015-06-11 20:12:13 EDT
I tried with Eclipse 4.4.0 and it also fails. Since it doesn't fail on more recent eclipses we can assume it is a bug in the Eclipse compiler that we've inherited. When we rebase on a more recent version we'll pick up the fix.  I can see the problem is that the default method getValue() in the interface is not getting a bridge method generated alongside it.

Thanks for the nice concise testcase
Comment 3 Andrew Clement CLA 2015-08-10 15:19:51 EDT
Fixed, I believe by recently picking up JDT changes.