strange ClassFormatError with indy

Remi Forax forax at univ-mlv.fr
Thu Aug 30 06:35:23 PDT 2012


The JVMS says the name must be a method name,
http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.1

A symbolic reference to a /call site specifier/ is derived from a 
|CONSTANT_InvokeDynamic_info| structure (§4.4.10 
<http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4.10>) 
in the binary representation of a class or interface. Such a reference 
gives:

  *

    a symbolic reference to a method handle, which will serve as a
    bootstrap method for an /invokedynamic/ instruction
    (§/invokedynamic/
    <http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.invokedynamic>);


  *

    a sequence of symbolic references (to classes, method types, and
    method handles), string literals, and runtime constants (i.e.
    primitive numeric values), which will serve as /static arguments/ to
    a bootstrap method;

  *

    a method name and method descriptor.


so "<init>" should be possible, but I don't think the EG discuss this 
corner case.

Rémi

On 08/30/2012 03:19 PM, Jochen Theodorou wrote:
> Hi all,
>
> I originally wrote that to the asm list, but nobody seems to know there.
> Anyway, for my generated bytecode the verifier complains with this message:
>
> java.lang.ClassFormatError: Method "<init>" in class test has illegal
> signature "(Ljava/lang/Class;Ljava/util/Map;)Ljava/lang/Object;"
>
> Now... there is not a single <init> method of that signature in the
> class test. What is new though (before it worked) is this indy call:
>
>>      INVOKEDYNAMIC <init>(Ljava/lang/Class;Ljava/util/Map;)Ljava/lang/Object; [
>>        // handle kind 0x6 : INVOKESTATIC
>>        org/codehaus/groovy/vmplugin/v7/IndyInterface.bootstrap((Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;)
>>        // arguments: none
> And this call has the signature the verifier complains about. Is this an
> illegal invokedynamic call?
>
> bye blackdrag
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20120830/f56e63eb/attachment.html 


More information about the mlvm-dev mailing list