Re: Re: ClassWriter#visit now final
Jochen Theodorou <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
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
bye blackdrag
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org
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