NoAccessException in registerBootstrapMethod()

4 views
Skip to first unread message

Sander Mak

unread,
Oct 14, 2009, 2:59:21 PM10/14/09
to JVM Languages
A little context: running the szegedi build (http://www.szegedi.org/
mlvm-macosx.html), trying to compile and run the simple Hello example
of the project coin proposal (http://wikis.sun.com/display/mlvm/
ProjectCoinProposal#ProjectCoinProposal-SIMPLEEXAMPLE%3A).

First of all I had to tweak the max. and min. heap size of javac/java,
otherwise there was an instant GC crash. After that, there where some
compile errors in the Hello example. Adding some throws Throwable
clauses and changing the way the static method lookup for the greeter
methodhandle is done solved those. Just normal API progress I guess,
resulting code can be seen in http://pastebin.ca/1620221

The example now compiles, and javap shows that an invokedynamic
bytecode is generated, yay! However, running the example results in
the following exception:

Caused by: java.dyn.NoAccessException: cannot access:
*.Hello.bootstrapInvokeDynamic
(java.lang.Class,java.lang.String,java.dyn.MethodType)
java.dyn.CallSite, from Hello
at sun.dyn.MemberName.newNoAccessException(MemberName.java:421)
at sun.dyn.MemberName.newNoAccessException(MemberName.java:412)
at sun.dyn.MemberName$Factory.resolveOrFail(MemberName.java:517)
at java.dyn.MethodHandles$Lookup.findStatic(MethodHandles.java:234)
at java.dyn.Linkage.registerBootstrapMethod(Linkage.java:100)
at Hello.<clinit>(Hello.java:24)

Am I missing something? Tried various access modifiers for the
bootstrapInvokeDynamic method, since the exception seems to indicate
access problems. No success though.

I just noticed the signature in the exception for
bootstrapInvokeDynamic that is expected is different from the one in
the example. Will look into that now, but any help is appreciated.

Thanks,

Sander

Rémi Forax

unread,
Oct 14, 2009, 3:24:04 PM10/14/09
to jvm-la...@googlegroups.com

This article contains a code sample that demonstrates
how to register a bootstrap method:
http://java.sun.com/developer/technicalArticles/DynTypeLang/

And yes, the valid signature is:

CallSite myBootstrapMethod(Class caller, String name, MethodType type)


> Thanks,
>
> Sander
>

cheers,
Rémi

Sander Mak

unread,
Oct 14, 2009, 4:30:40 PM10/14/09
to JVM Languages

> This article contains a code sample that demonstrates
> how to register a bootstrap method:http://java.sun.com/developer/technicalArticles/DynTypeLang/
>
> And yes, the valid signature is:
>
> CallSite myBootstrapMethod(Class caller, String name, MethodType type)

Thanks for the pointer to the article. The signature was the culprit
indeed. Sometimes it's a little hard to distinguish the outdated code
samples :-)
Reply all
Reply to author
Forward
0 new messages