Re: Re: Re: ClassWriter#visit now final
Rémi Forax <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
On 11/22/2011 03:29 PM, Jochen Theodorou wrote:
> Am 17.11.2011 20:55, schrieb Eric Bruneton:
>> Jochen Theodorou wrote:
>>> Hi all,
>>>
>>> I just noticed, that ClassWriter#visit is now final. We used a
>>> ClassReader to first read a class and then write it out again with a
>>> different super class. I strongly assume the old code, in which we
>>> simple extended the class and rewrote the visit method is wrong. But
>>> how
>>> is it done correctly then?
>>
>> you should write a subclass of ClassVisitor. The old code is "wrong" in
>> that it does not specify an API version and so backward binary
>> compatibility can not be ensured.
>
> You wrote "wrong", because before it was an interface and thus you
> couldn't even go this way I strongly assume. But I couldn't really
> find an explanation for that api version thing. Looking at the source
> code:
>
>> public ClassVisitor(final int api, final ClassVisitor cv) {
>> /*if (api != Opcodes.ASM4) {
>> throw new IllegalArgumentException();
>> }*/
>> this.api = api;
>> this.cv = cv;
>> }
>
> The information is stored in a protected field and then it seems to be
> forgotten. Maybe you could explain a bit the intention? Probably it
> was discussed here already... I didn't find that either... since you
> changed from interface to class anyway, it cannot have anything to do
> with asm 3.x
If you take a look to the way ASM has evolved, we break the binary
compatibility
by example because some parameters was added to a method.
When ASM5 will be out, the API version value will help us to wire
a call to the old API to a call to the new API to provide a kind of
emulation layer.
>
> bye blackdrag
>
cheers,
Rémi
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