Invoking a default method can cause IllegalAccessError (original) (raw)
Stephan Herrmann stephan.herrmann at berlin.de
Mon Apr 1 16:48:18 PDT 2013
- Previous message: Invoking a default method can cause IllegalAccessError
- Next message: my problem seems to be solved with march release
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanks for the link.
You mean, when Eclipse generates code that runs on a current VM (e.g. b81), that's actually "wrong"? :)
Asked differently: where would I learn which bridge methods will indeed be needed on a correctly implemented VM?
Stephan
On 04/02/2013 01:09 AM, Dan Smith wrote:
This is a known bug: http://bugs.sun.com/viewbug.do?bugid=8009130
It's actually the VM, not javac, that is generating the faulty invokespecial call... —Dan On Mar 31, 2013, at 7:36 AM, Stephan Herrmann <stephan.herrmann at berlin.de> wrote:
Compile these 2 files using 1.8.0-ea-lambda-nightly-h3673-20130312-b81-b00:
----8<--- p2/J.java ---8<---- package p2; interface I { public default void foo() { System.out.println("default"); } } public interface J extends I {} ----8<--- p1/C.java ---8<---- package p1; public class C implements p2.J { public static void main(String[] args) { C c = new C(); c.foo(); } } ----8<----- Running p1.C yields: Exception in thread "main" java.lang.IllegalAccessError: tried to access class p2.I from class p1.C at p1.C.foo(C.java) at p1.C.main(C.java:5) Obviously javac forgot to generate a synthetic super access into J (not expecting that interfaces ever need such, but ..) cheers, Stephan
- Previous message: Invoking a default method can cause IllegalAccessError
- Next message: my problem seems to be solved with march release
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]