Loading int.class onto the stack

Arshan Dabirsiaghi <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Sorry in advance for what is probably a stupid question.

How do I load the int.class primitive Class representation (as opposed to
Integer.class) via an ldc instruction? I've tried the following:

visitLdcInsn( Type.getType(int.class) );
visitLdcInsn( Type.INT_TYPE );
visitLdcInsn( Type.getType("I") );

These either cause NoClassDefFoundErrors or generate the wrong type (they
generate Integer.class instead of int.class).

The compiler generates GETSTATIC instructions to fetch the int.class
indirectly from Integer.TYPE, like for the code show:

Class[] classes = new Class[]{int.class};

Emulating this isn't currently causing us any direct issues, but I don't
know if it's a good idea or performant when compared to a direct reference
to int.class.

Thanks,
Arshan
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.