Re: Re: Re: Re: Re: Re: Re: Re: Re: ASM 4 is ready ?
Eric Bruneton <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
10/01/2011 20:53, Rémi Forax wrote:
> You can always separate in two classes and use a byte array to transfer
> the bytecodes between the two classes.
> The question is more Does users will always cleanly separate their code ?
> As a user of ASM myself, the answer is not always :)
so this is another good reason to use the same names as in java.dyn,
because it will encourage users to write cleanly separated code :-)
> I have 3 medium projects that use ASM and method handles and all 3 have
> at least one class that
> mix ASM code and java.dyn code.
>
> It's more natural in my opinion to return a java.dyn.MethodHandle as
> result of the generation
> of the bytecode of a method instead of returning a byte array.
>
> There is also the problem of a user choosing the wrong import, as I said
> this will create a hard to track bug.
in a compiler it seems natural to always import the ASM classes, use
String instead of Class, MethodType, etc as most as possible, and
finally use fully qualified names for the few remaining java.dyn types
occurences.
For instance, in the code you posted on your blog,
public MethodHandle invokeDynamic(String name, MethodType desc,
Class<?> bsmClass, String bsmName, MethodType bsmType, Object... bsmArgs) {
could be replaced with
public java.dyn.MethodHandle invokeDynamic(String name, String desc,
String bsmClass, String bsmName, String bsmType, Object... bsmArgs) {
java.dyn is needed at only one place, and using String instead of Class
and MethodType makes the code not only more cleanly separated from the
runtime, but also more general since it can now be used for classes not
yet generated or not yet loaded in the VM
Eric
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