Bug 469889 - java.lang.AbstractMethodError calling default method in Java 1.8
Summary: java.lang.AbstractMethodError calling default method in Java 1.8
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.8.7   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-10 19:42 EDT by Hugh Eaves CLA
Modified: 2015-08-10 15:19 EDT (History)
1 user (show)

See Also:


Attachments
Code to reproduce error (1.13 KB, application/x-zip-compressed)
2015-06-10 19:42 EDT, Hugh Eaves CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.