Project: AspectJ
Bug 109173 Weaving Adaptor enhancements for performance, configuration and diagnosis
Reported: 2005-09-09 12:49:04 | Status: resolved fixed

Here are some suggested enhancements as a result of exhaustive testing in the Eclipse/OSGi environment. 1. If no aspects are declared for a particular class loader, either because there are no visible aop.xml files or they contain no aspect definitions, then we should short-circuit the implementation of weaveClass() so that byte-code is not unnecessarily passed to the weaver. This is especially important under OSGi where there may be hundreds of class bundles, each with their own class loader only some of which are being woven. We can use the existing enabled flag. 2. As previously discussed on aspectj-dev the META-INF directory is considered private in OSGi and is therefore an inappropriate location for aop.xml files declaring shared aspects. I therefore propose a System property to set the a resource names for finding aop.xml files which would default to META-INF/aop.xml e.g. -Dorg.aspectj.weaver.loadtime.configuration=META- INF/aop.xml;org/aspectj/aop.xml. 3. We should not be catching Throwable in Aj. Instead we should catch known exceptions e.g. BCException and issue messages while letting other runtime exceptions pass back to the class loader. A user provided IMessageHandler implementation can decide under what circumstances to abort. Alternatively if Aj is considered to be a safe interface for weaving agents e.g. JVMTI then the dump logic it contains should be moved to the WeavingAdaptor so that it can be used directly from a class loader.

Files changed in fix:
loadtime/src/org/aspectj/weaver/loadtime/Aj.java loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java loadtime/src/org/aspectj/weaver/loadtime/DefaultWeavingContext.java loadtime/src/org/aspectj/weaver/loadtime/IWeavingContext.java