Re: RE: ASM-based class transformation affect class loading?
Simone Bordet <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Hi, On Tue, Aug 3, 2010 at 19:24, Tim Eck <[email protected]> wrote: > I’m not entirely sure if this is your problem or not, but one lesser known > things about ClassFileTransformer agents is that they are not reentrant. If > the course of instrumenting a class (ie. within your transform() method) > you cause another class load then the transformer will be skipped. If your > transform loads other types (for verification or other purposes) then you > might miss types. I have been bitten by this as well, but IMHO this is a misfeature (if not a bug), at least for the way I read the javadocs of ClassFileTransformer.transform(): "Once a transformer has been registered with addTransformer, the transformer will be called for every new class definition and every class redefinition. Retransformation capable transformers will also be called on every class retransformation. The request for a new class definition is made with ClassLoader.defineClass or its native equivalents. ..." So, if class transformation triggers a class loading, even in native code, transform() should be called again, according to the javadocs. I have submitted a bug for this in 2007, but AFAIK it never surfaced the public list of bugs, and I never got any reply from the bug submittal process: "Your Report (Review ID: 1110557) - Classloading during transformation does not invoke ClassFileTransformer ... Date Created: Fri Nov 16 08:36:43 MST 2007 Type: bug Customer Name: Simone Bordet status: Waiting Category: java Subcategory: classes_lang Company: N/A release: 6 hardware: x86 OSversion: linux priority: 4 Synopsis: Classloading during transformation does not invoke ClassFileTransformer Description: FULL PRODUCT VERSION : java version "1.6.0_03" Java(TM) SE Runtime Environment (build 1.6.0_03-b05) Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing) A DESCRIPTION OF THE PROBLEM : A JVMTI Java Agent is installed, and a ClassFileTransformer is registered. From that point on, the ClassFileTransformer should be called for any class definition. However, if class loading (and hence class definition) is triggered from ClassFileTransformer.transform(), the class under load is not passed to ClassFileTransformer.transform(). " Had no time to investigate further why it was not accepted. Simon -- http://bordet.blogspot.com --- Finally, no matter how good the architecture and design are, to deliver bug-free software with optimal performance and reliability, the implementation technique must be flawless. Victoria Livschitz
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