Re: Re: subclass and superclass transformation question
Marcel Patzlaff <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Just load the parent classes/interfaces as resources and analyse them with ASM. If you have to perform modifications, you should do what Eugene suggested: Prepare the transformations virtually and apply them if the classloader eventually loads the parent classes/interfaces. Regards, Marcel Tronje Krop schrieb: > I'm currently not using the java agent, but I like to do son in > future. > > My problem concerning the order of class loading is, that I need > at least to analyse parent classes and interfaces before trans- > forming the subclasses. > > But how can I do this without forcing the class loader to load > interfaces and parent classes. Any suggestion? > > CU Tronje > > Eugene Kuleshov wrote: > >> I wouldn't advise loading classes from the agent. Instead you should >> be able to prepare required transformations "virtually" when >> analyzing/loading subclasses, save some state and do the actual >> transformation when parent is actually loaded by JVM. >> >> regards, >> Eugene >> >> >> On Tue, Feb 23, 2010 at 10:01 AM, Rémi Forax <[email protected]> wrote: >> >>> Hi Peter, >>> >>> Le 23/02/2010 14:49, Peter Veentjer a écrit : >>> >>>> I have a question about the details of superclass/subclass >>>> transformations using a Java agent. >>>> >>>> If there is a class Fruit and a subclass Apple, and if a new Apple is >>>> created before the Fruit class is used in the JVM. >>>> What is the exact order of classes loaded in the Java agent? >>>> >>>> My experience is that the Apple class is transformed before the Fruit >>>> class is transformed. Is this correct? >>>> >>>> >>> Yes, the VM read the transformed class, find the super class and load it, >>> so superclass are loaded after class if there aren't loaded before. >>> >>> But you can load the superclass in the agent :) >>> you have the classloader and you can find the superclass in the classfile. >>> Just be careful about synchronisation, jdk7 classloading is done in >>> parallele. >>> >>> >>> >>>> And is there any way to force to load the super class (Fruit) is >>>> transformed before the subclass Apple is transformed? >>>> >>>> I have the impression that the Java agent technology is very limited >>>> and that the only way to solve these issues is >>>> to do a static transformation. The big problem is that it makes the >>>> system much harder to work with from an IDE; normally >>>> you only need to register some javaagent and you are done. But adding >>>> a postcompilation step is much harder. >>>> >>>> >>> 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