Hello,

I'd like to enhance AspectJ Java agent processing a bit, so I
decorated ClassFileTransformer from AspectJ agent using this code in
my ClassFileTransformer:

public synchronized byte[] transform(ClassLoader loader, final String
name, Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
                        byte[] code) throws IllegalClassFormatException {
    code = myPreModifications(code);
    code = aspectjClassFileTransformer.transform(loader, name,
classBeingRedefined, protectionDomain, code);
    return myPostModifications(code);
}


Changes done by myPostModifications method are visible, but changes
done before AspectJ (myPreModifications) aren't visible.
I've found that AspectJ just ignores "code" parameter (i can just pass
null: aspectjClassFileTransformer.transform(loader, name,
classBeingRedefined, protectionDomain, NULL)). AspectJ seems to
perform some class caching in World.TypeMap.expendableMap, and reuses
previously loaded classes.
I tried to set World.TypeMap.useExpendableMap to false, but then
AspectJ stops working.

How to make this preprocessing before AspectJ work? How to disable
this ugly caching?


Irek
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to