Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Compile ITD aspect separately from class to be enhanced?

Sorry, this might be a stupid question with regard to an obvious "hen vs. egg" problem, but I am asking anyway:

The beauty of aspect libraries is that they can be compiled separately and woven later, either by compiling it into Java (source or binary) code via ajc or by applying them via LTW. This works for most "normal" aspects. So far, so good.

Aspects using ITD, e.g. adding methods or members to existing Java classes, are different though. It seems they cannot be compiled with ajc into separate libraries without them accessing the target Java classes. While this makes sense logically, it causes a modularity problem as follows: Say we have a Maven project containing a Java library and and AspectJ library. The Java library without aspects is a valid artifact and can be used normally. Another aspect-enhanced JAR should be an additional artifact created by combining the AspectJ library and the Java library. But this would require the AspectJ library to be compileable without a dependency on the Java library. This would also allow me to have separate aspect libraries doing ITD on the same target classes.

My explanation looks awkward to myself, but I hope you understand anyway. My question is: Is there a way to compile ITD aspects independently from the target classes and later weave them into those very target classes, similar to LTW where aspects are compiled but unfinished until woven into the classes? Or would it be at least thinkable to have such a feature in the future?
-- 
Alexander Kriegisch
http://scrum-master.de


Back to the top