Bug 73912 - Request a new constructor in WeavingAdpator
Summary: Request a new constructor in WeavingAdpator
Status: RESOLVED WORKSFORME
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-14 15:11 EDT by Larry Zhou CLA
Modified: 2005-03-23 08:36 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Larry Zhou CLA 2004-09-14 15:11:06 EDT
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.
Comment 1 Matthew Webster CLA 2004-09-21 09:54:48 EDT
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.
Comment 2 Adrian Colyer CLA 2005-03-23 08:36:31 EST
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.