Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Can I intercept before a class is load time weaved

Hi!

1. Ability to intercept just before a class is load time weaved. In
this 'advice', the normal class should be available so that a check
can be made for SUID using java reflection.
2. Ability to proceed without weaving if I don't want to weave that class.

You cannot use reflection for these checks since the class in not yet defined in the VM when you try to weave at load-time. Load-time weaving happens before the class is passed to the JVM. Therefore you would need to do something on the level of the weaver itself, using ASM or BCEL to do this check. You just have bytecode... :-(

I am not an expert for the weaver implementation of AspectJ itself, but I assume you would need to extend the AspectJ weaver somehow to do this kind of things. I would take a look at the ClassLoaderWeavingAdaptor, maybe the accept method is what you need. But the AspectJ guys have more insights and might come up with a better solution.

-Martin



Back to the top