Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Aspect Weaver

On Thu, 2003-11-06 at 13:27, Jim Hugunin wrote:
> Weaving in AspectJ-1.1 is designed to play well with Java’s existing
> modularity.  Let’s assume that your system has a tracing module that
> includes several aspects and a large number of pure Java modules A, B,
> …, Z.
> 
>  
> 
> Your build process needs to first build the tracing module and write
> it into tracing.jar.  As you’d expect, this .jar will need to be
> rebuilt when and only when code in the tracing module is changed.
> 
>  
> 
> If you make a change to module B you will need to recompile that
> module in the same way that you would in a pure Java world.  You have
> two choices for how to make sure your aspects are applied to that
> module.  You can build your module with ajc instead of javac and use
> the –aspectpath option to ensure that the aspects in tracing.jar will
> be applied to the resulting code.  If you’d prefer, you can compile
> module B with javac (or jikes or any other Java compiler) and produce
> a pure java unwovenB.jar file – this has the advantage of being able
> to use your existing build process with the least changes.  You will
> need to add a final step to your module’s build process that will use
> ajc to apply tracing.jar to unwovenB.jar and produce the final B.jar.
> 
>  
> 
> Note: if you use the simple support in ant to only recompile
> individual .java files whose source has been changed, you could in
> theory combine this with ajc to also just reweave those same files. 
> There are some subtle issues with this approach, but if you’re
> comfortable with the problems that the ant solution has for pure Java
> systems, ajc shouldn’t add any new issues to a design like this.
> 
>  
> 
> As we mention in the paper, a completely different solution to this
> problem is to perform all of the weaving at class load time instead of
> at build time.  The 1.1 weaver implementation can support this in
> theory, but there’s more work to be done to make this something that
> is easy for developers to just use.  However, I don’t believe that
> this approach has many benefits over using ajc in linker mode as a
> final step in your build process.

I have found that to be the case mostly, but if anyone is interested  we
have a rudimentary start of some runtime weaving. Totally alpha and just
hacking around.

http://cvs.codehaus.org/viewcvs.cgi/plexus/plexus-aspectj/src/java/com/hksys/aspectj/AspectJClassLoader.java?rev=1.1.1.1&root=codehaus&view=auto

>  
> 
> -Jim
> 
>                                    
> ______________________________________________________________________
> 
> From:aspectj-users-admin@xxxxxxxxxxx
> [mailto:aspectj-users-admin@xxxxxxxxxxx] On Behalf Of Trishan de
> Lanerolle
> Sent: Wednesday, November 05, 2003 10:37 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: RE: [aspectj-users] Aspect Weaver
> 
> 
>  
> 
> Hi Jim,
> 
> 
> Would it be possible for you  to make a clarification to a comment
> made in the paper " Advice weaving in AspectJ". This was a question
> raised by one of our Architects. In section 2 "The compilation
> process", you mention a back-end weaving AOP which can be used to
> implement ClassLoaders that would weave advice into classes
> dynamically as they are loaded by the virtual machine. I am not sure
> if this relates to the question raised, however one of the concerns
> brought up was how does AspectJ address the builds. In a modular
> structure, would it dynamically pick the modules that require weaving
> or would it do a single monolithic build having to go though all the
> modules each time. I am not sure how to answer this question and would
> appreciate any feedback. This is a major concern with large project
> builds which sometimes go into several hours. So each time a change
> is made, would it mean a complete recompilation or dynamic update.  
> 
> 
> Thank you
> 
> 
> Trishan
-- 
jvz.

Jason van Zyl
jason@xxxxxxxxxxx
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society



Back to the top