Community
Participate
Working Groups
I want to use WeavingAdaptor directly from my project, but I don't bother classLoader at all. Currently, I just copied WeavingAdaptor.java in my project, rename is as AspectJWeavingAdaptor.java, and made an extra constructor, like this public AspectJWeavingAdaptor (List classPath, List aspectPath) { init(classPath, aspectPath); } So far, it works great for me. I am happy with what I have right now. To make it even better, since it is mostly a copy from original WeavingAdaptor, Is it possible to make an extra constructor in AspectJ's WeavingAdaptor.java? So I can get rid of my wrapper file AspectJWeavingAdaptor completely, aslo I can take advantage of any enhancement there. I understand that I don't use classloader at all, I only need the functionality of load-time weaving. To me, in order for weaver to work, it only needs classPath and aspectPath, nothing more. Adrian replied: Without looking at the source, this sounds like a reasonable request to me. Strictly the weaver may need up to three paths in order for it to work: an inpath (types that will be woven into), a classpath (for resolving types - these will not be woven into), and an aspectpath (aspects). We could add a constructor that takes all three and allow null or an empty list in any position.
The WeavingAdaptor class currently has 2 constructors: public WeavingAdaptor (GeneratedClassHandler handler, URL[] classURLs, URL[] aspectURLs) public WeavingAdaptor (WeavingClassLoader loader) { The first signature was chosen as it is similar to that for a URL class loader which is the most likely candidate for a weaving class loader. The GeneratedClassHandler is required because AspectJ can generate classes during weaving (around closures) which MUST be handled by the caller if a class loader is not supplied. The second is a convenience constructor and a intermediate step to more dynamic class resolution. Currently the weaver needs the bytecodes to reslove ALL classes including BOOTCLASSPATH. Is the enhancement request to have a constructor that takes 2 List objects rather that 2 arrays? An inpath is not required for LTW as that job is performed by the caller to the WeavingAdaptor.
I'm closing this bug out as there has been no comeback since Matthew's answer 6 months ago. Please reopen if you believe there is still an unaddressed requirement here.