Bug 121700

Summary: Contribution: Always Weaving URL ClassLoader
Product: [Tools] AspectJ Reporter: Ron Bodkin <rbodkin+LISTS>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: REOPENED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: pombredanne
Version: DEVELOPMENT   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
always weaving nondelegating classloader
none
Prebuilt jar containing a compiled version of the classloader, which works with AspectJ 1.5.0 (and later I believe) none

Description Ron Bodkin CLA 2005-12-21 03:13:04 EST
I have found this class to be quite helpful as a way of using load-time weaving to run inside an IDE. This nondelegating classloader weaves into any classes on the system classpath, making it work well as a drop in load-time weaving option with a single command -Djava.system.class.loader=org.codehaus.ajlib.util.classloader.AlwaysWeavingURLClassLoader 

This avoids the difficulty of changing how IDE's like IntelliJ set up their classpath. For that matter, how does the Eclipse load-time weaving configuration work? It seems like it won't weave things on the classpath either and would benefit from this class as well. It didn't allow me to weave any classes in my test project, whereas this does.
Comment 1 Ron Bodkin CLA 2005-12-21 03:16:22 EST
Created attachment 32066 [details]
always weaving nondelegating classloader

to integrate this into the code base it would be better to refactor to eliminate duplicated private methods from the WeavingURLClassLoader...
Comment 2 Ron Bodkin CLA 2006-04-07 17:40:10 EDT
Created attachment 38055 [details]
Prebuilt jar containing a compiled version of the classloader, which works with AspectJ 1.5.0 (and later I believe)
Comment 3 Wes Isberg CLA 2006-05-10 11:23:34 EDT
Thanks for the example, Ron.  Given the AJDT support for a load-time weaving configuration, I'm not sure this is still required as an AspectJ offering (and I'm reluctant to promote nondelegating class loaders).  But it does seem worth publishing for other IDE's and users; do you want to publish it yourself?  Please reopen if you disagree.
stalebug
Comment 4 Ron Bodkin CLA 2006-05-10 11:29:17 EDT
I think it's still useful for two classes of users:
- those using IntelliJ
- those using Java < 5 (as I understand it the AJDT support for load-time weaving using -javaagent)

While I agree that nondelegating classloaders have their problems, I think it'd be better to include this as part of AspectJ.
Comment 5 Matthew Webster CLA 2006-06-29 09:18:33 EDT
Some comments:
>those using IntelliJ
I don't believe we include any IDE-specific support in AspectJ (anymore)

>those using Java < 5 (as I understand it the AJDT support for load-time
>weaving using -javaagent)
We use -Djava.system.class.loader for 1.4. There is no reliable mechanism for 1.3

>While I agree that nondelegating classloaders have their problems, ...
They are an evil hack