Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Re: Load-Time Weaving configuration

Hi Matthew,

I have been playing with subclasses of ConcreteName (based on your example)
obtained from a new JVMObjectTypeProvider supplied to the WeavingAdaptor on
construction. I haven't got it working yet so decided to fall back on your
suggested use of "getResourceAsStream()" to get the actual bytecodes for a
class without knowing the static classpath (class loader delegation does it
for you) as a way of fixing
https://bugs.eclipse.org/bugs/show_bug.cgi?id=74246. I am using a modified
ClassPathManager constructed with a ClassLoader. It's also a way of loading
the bytecode for an aspect which we still need to do to obtain aspect
metadata (pointcuts, perclause, ITDs, ...) until/unless we chose expose
this another way at runtime (Java 5 metadata perhaps).

For my subclass of ConcreteName (which works now pretty well) I am using the system class loader to load the class object if the class package starts with java oder javax. This class object is passed to my subclass of ConcreteName to obtain the necessary information. Works fine (and I do not need bytecode for those classes). But it depends of the precondition that these classes are not load-time woven.

The bytecode for all other classes is loaded via getResource from the bundles/plugins (uses the bundle/plugin classloader), constructing a JavaClass object.

However I have  got stuck with aspectpath. Currently it's defined just like
classpath and the WeavingAdaptor iterates over the URLs calling
BcelWEaver.addLibraryJarFile() which figures out which types are aspects.
Unfortunately this has SecurityManager issues. What I'd rather have is just
a list of the aspects types which the weaving class loader has already
figured out (it has the correct file/network read access already).

How did you configure aspectpath in your Eclipse LTW implementation?

In my Eclipse LTW implementataion the aspectpath configuration is a completely different thing. I am using the extension point mechanism of Eclipse to let plugins promote aspects. The LTW plugin for the Eclipse runtime reads all extensions of this extension point. Having the aspects being defined in extensions I can use the same mechanism as mentioned above to load the bytecode of the aspects (getResource via the bundle). Then the bytecode stream is passed to a ClassParser to create an object of type JavaClass. This is added to the world via "addSourceObjectType" and to the weaver via "addLibraryAspect" (only the name).

I have no idea whether this might help you or not, but I hope it does.

Best regards,
Martin



Back to the top