Re: Re: Re: Generics in ASM APIs?
Rémi Forax <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Le 31/01/2011 00:43, Howard Lewis Ship a écrit :
> What is the criteria for abandoning JDK 1.3/1.4 support so that
> annotations can be fully embraced? Or is there a desire to avoid some
> kind of overhead associated with generics, rather than just purely
> support for older JDKs?
There are two problems:
- one is to run ASM on a 1.3/1.4 VM, in fact depending on
the package they can run on a 1.3+ or 1.4+ VM.
This implies that we can't use JDK's APIs that was introduced
by example with jdk5.
- the other is that the API of ASM, doesn't use language features
introduces 1.5,
generics, varargs, enums, etc. Some features like by example enums
relies on
JDK class (java.lang.Enum) so we can't use it in ASM because ASM
will not run
anymore on 1.3/1.4 VM. Generics or varargs are differents, there are
1.3/1.4 compatible
because they are implemented by adding attributes in the classfile.
So we can use generics or varargs in the ASM API without loosing the
1.3/1.4 support.
Now, using generics or varargs will make the size of asm.jar bigger
and the added
attributes are only used when compiling not at runtime (unless you
use reflection).
So the idea is to provide two jars, one with the attributes for
compiling and
one without the attributes for running.
With this strategy we keep the best of both options, ASM is still
1.3/1.4 compatible
at runtime and ASM API can be generified.
Rémi
> On Wed, Jan 5, 2011 at 7:30 AM, Rémi Forax<[email protected]> wrote:
>> On 01/01/2011 12:21 AM, [email protected] wrote:
>>> I've been searching the archive for this, haven't found much.
>>>
>>> Is there any plan to apply generics to collections in the ASM APIs? I use
>>> the
>>> Tree API and I'd prefer ClassNode to define List<AnnotationNode> (and so
>>> forth)
>>> rather than just List.
>>>
>>> I realize that ASM predates JDK 1.5 generics, but that's five years ago
>>> now!
>> There is a plan in my mind :)
>>
>> The idea is to generify ASM but customize the optimizer to generate 1.3
>> compatible bytecode.
>> With that, asm-all.jar will be 1.3 compatible but asm-all-debug.jar will be
>> 1.5.
>> So you can compile using asm-all-debug.jar and use generics and
>> run using asm-all.jar which is as small as always.
>>
>> Alas, I have no time to play with that idea,
>> but I can sponsor anyone who want to try :)
>>
>> Rémi
>>
>>
>>
>>
>> --
>> 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
>>
>>
>
>
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