Re: Errors caused by already instrumented classes
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <1993472713.466441316855605214.JavaMail.root@zimbra7-e1.priv.proxad.net> |
Lukas Marek wrote: > Hello, > > we are instrumenting classes using two our own tools build on top of > the > ASM. Both tools are used in a chain where classes are passed as bytes > > between the tools. Both tools should produce valid class as their > output. > > We encountered some errors in ASM when passing instrumented class from > > the first tool to the second one. In the first tool, the class is > properly (with no errors) instrumented and validated using > CheckClassAdapter. They are also successfully loaded with jvm if the > second instrumentation tool is skipped. > > There are two cases where the ASM fails to load the classes produced > by > the first tool. > > I've created byte dumps of the class produced by the first tool and > simple asm test cases where it fails in the second one. > > In the first scenario called "example1", if the "CheckClassAdapter" is > > removed, everything works fine. Otherwise, it produces > ArrayIndexOutOfBoundsException in MethodWriter class. > > Second scenario (example2) uses ClassVisitor and AdviceAdapter. If the > > AdviceAdapter is replaced with MethodVisitor, everything works fine. > > EditA and A sources should be another example of the second scenario > done by my colleague. > > We are using ASM 4.0 RC2. the first example did not work because you can't visit the same class node instance twice (labels must be reset between visits, see InsnList.resetLabels). For convenience, I propose to automatically reset the labels when MethodNode.accept is called several times (see attached patch) the second example did not work because of a bug in AdviceAdapter (fixed in attached patch). 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