Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Modified classes of the Jar files in Inpath (which shouldn't be modified)


I totally agree even though the jar that I am weaving has 1000+ class files.
I actually had converged on the idea which you suggested as the best model,
but I just wanted to know if any (even better) alternatives exist.
Cheers.


Matthew Webster wrote:
> 
> I'd like to comment on the first part of your post while Andy deals with 
> the second
> 
>>Firstly, what I am doing is to modify some of the classes in a 3rd party
>>framework using AspectJ. I am using Eclipse AspectJ plugin and so on. So 
> I
>>add the 3rd party library in the Inpath of AspectJ and apply my advices, 
> and.
>>some of the classes from the framework get modified by AspectJ. This is 
> the
>>main work flow. By the way, as a side question I'd like to ask this: 
> AspectJ
>>extracts _all_ the class files from the 3rd party Jar file into the bin
>>directory, even if 99% percent of them never gets modified. I think this 
> is
>>the expected behaviour, but is it possible to have AspectJ extract only
>>those files which gets indeed advised/modified?
> What you are trying to do can be achieved with Ant and the iajc task. We 
> didn't want to bloat ajc with capability that was already available 
> elsewhere. While it might seem attractive to be selective with the classes 
> you weave it could be problematic in the long run. The only advantage is 
> performance and probably only with large JARs e.g. 1000+ classes. The best 
> model is to weave the entire JAR, give it a slightly different name and 
> replace the original one in you runtime. One approach would be to produce 
> a small JAR containing just woven classes, and any generated by the 
> weaving process, and place it on the CLASSPATH ahead of the original. 
> However, this can be confusing because there will be 2 versions of some 
> classes in the system. Furthermore if any classes in the JAR are changed 
> which means they are now matched by an existing aspect, an aspect is 
> modified so that it matches different classes or new aspects are added you 
> will have to change your build process. This is fragile. In short unless 
> you have a very large JAR it's best to let AspectJ decide which classes 
> are woven.
> 
> Matthew Webster
> AOSD Project
> Java Technology Centre, MP146
> IBM United Kingdom Limited
> Hursley Park, Winchester,  SO21 2JN, England
> Telephone: +44 196 2816139 (external) 246139 (internal)
> 
> 

-- 
View this message in context: http://www.nabble.com/Modified-classes-of-the-Jar-files-in-Inpath-%28which-shouldn%27t-be-modified%29-tf3299223.html#a9180289
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top