ASM 4 RC1 released !

Rémi Forax <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
I'm proud with Eric and Eugene to announce the release of ASM4 RC1.

This release is available to download here:
   http://forge.ow2.org/projects/asm/

So what's new !
- Full support of Java 7.
   Because Java 7 introduces several changes in the bytecode format [1],
   all other versions of ASM aren't able to deal with this new format.
   That why I strongly recommend you to use ASM4.

- Overhaul of the support of invokedynamic to support the new encoding
   and bootstrap method arguments.
   Practically, this means that invokedynamic doesn't trigger a call to
   MethodVisitor.visitMethodInsn but use a specific new method:
   visitInvokeDynamicInsn(String name, String desc, MethodHandle bsm, 
Object... args)

- Two new constants org.objectweb.asm.MethodHandle and 
org.objectweb.asm.MethodType
    can be used either in visitLdcInsn() or as last arguments of 
visitInvokeDynamicInsn.
    org.objectweb.asm.MethodHandle encodes a constant method handle and
    org.objectweb.asm.MethodType encodes a constant method type.

Here is the snippet of how generate an instruction invokedynamic foo()V 
that will
call as bootstrap method bootstrapName with two bootstrap constants 
"bar" and 3.

|MethodVisitor mv = ...|
|MethodHandle bootstrap = new||MethodHandle(Opcodes.MH_GETSTATIC, "BoostrapClass", "boostrapName",|
|   "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite;"||||);|
|mv.visitInvokeDynamicInsn("foo", "()V", bootstrap, "bar", 3);|


- ASM4 API has been generified to use generics and varargs
   but almost all jars are still small and 1.2 compatible.
   In fact, there is a trick, the API is 1.5 compatible but the bytecode 
is downgraded
   to be 1.2 compatible using a bytecode rewriter (our own dog food).

   To use the 1.5 compatible API you have to compile using 
all/asm-debug-all-*.jar
   which is 1.5 compatible and also contains the debug information.
   When running you can use all/asm-all-*.jar or several asm-*jar 
depending on your usage.
   Except all/asm-debug-all-*.jar all other jars are 1.2 compatible and 
optimized.
   If you want debug information at runtime you have to use 
all/asm-debug-all-*.jar.

   ASM4 API has been generified to be as compatible as possible with 3.3 
API.
   So some methods now return an array of parametrized type which are 
not type safe
   (not less than before in fact) if you store something in it.
   The other solution should have been to use a List instead of an array
   but this introduces too many incompatible changes.
   The package org.asm.tree.analysis is now fully typesafe but during 
that process,
   we have changed some signatures in Interpreter subtypes so if your code
   uses an ad-hoc interpreter it has to be updated.

regards,
Rémi

[1] 
http://download.java.net/jdk7/docs/api/java/lang/invoke/package-summary.html
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.