[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Why need AspectJ all libraries of my .jar I want to instrument

This thread tripped something in my memory: an alternate way to do what Ron suggests, but without the trial and error. So I put the question to the Tucson JUG:

I rememeber a discussion on this list about tools for JAR slimming:
ditching all the classes in a JAR than can be proved by static analysis to
be unused by your code. Does anyone else remember this and can they tell me
what the tools were that accomplished this feat?

Ant's own <classfileset> can do this using BCEL:


And so does GenJar:


(Credit for the answer goes to Erik Hatcher, Ant guru). Hope those help for future problems of this nature.


On Feb 25, 2004, at 7:58 AM, Ron Bodkin wrote:


I have done something similar with the TopLink jar. What I did was to explode the jar and to incrementally strip down to a subset of classes that referenced the jars I did have. The other classes are never loaded by my app so by definition I don't need them. I did this by removing any class files that had references the weaver choked on, then retrying to weave again, and repeating until there were no errors. This is a recipe that should work for weaving into any jar that has references to classes you don't have access to.

This is a case where having weaving classloader support will be very helpful: you will never need to worry about having unreferenced classes in the classes you load (since this would also cause the JVM to throw a class not found exception).

Note that in many cases the weaver does need to resolve references to external types, so it would be fairly complicated to optimize it to minimize such dependencies. I think classloader weaving is the way to go.


Ron Bodkin
Chief Technology Officer
New Aspects of Software
m: (415) 509-2895

------------Original Message------------
From: Michael Dempfle <mdempfle@xxxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Date: Wed, Feb-25-2004 6:50 AM
Subject: [aspectj-users] Why need AspectJ all libraries of my .jar I want to instrument


I want to insert aspects in a .jar file of oc4j.
Unfortunately this jar file is not very consistent and has classes
which ware not used but uses classes which are not available.

When I want to use AspectJ I cannot weave the code
into the other class files because AspectJ is checking everything.

Is it possilbe to remove this check? AspectJ is using BCEL and
therefore there is not need for that!.

Are there any solutions?

Michael Dempfle

aspectj-users mailing list

aspectj-users mailing list