Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Interesting Problem & Reweavable

Hi All,
 
I've been working on applying the AspectJ 5 load-time weaving support from
the branch that Alex and Jonas have been working on, to let me weave some
monitoring code into an app server at load time. The code is still fairly
new, but I was able to get it working for my environment, which was great
(already much better than trying to weave into a wad of 3rd party jars at
build time!). Great work guys! I plan to blog about this and to submit a few
small suggestions to bugzilla and aspectj-dev.
 
However, I ran into the following output when I was weaving into the MySQL
JDBC driver's debug version:

error at com\mysql\jdbc\NonRegisteringDriver.java::0 class
'com.mysql.jdbc.NonRegisteringDriver' is already woven and has not been
built with -Xreweavable

That's right. This error means that the code was already woven with AspectJ!
The MYSQL debug JDBC driver includes a tracing aspect: it's great to see
this kind of increased use & popularity of AspectJ. For the curious, you can
see the source code for this aspect in the source distribution of the Mysql
Connector/J. In this case, the normal, non-debug, library doesn't use
AspectJ so it's not a major problem.(*)
 
Unfortunately, because the default today is to not emit reweavable bytecode,
it makes it challenging to weave into libraries like this. I think the
increasing amount of AspectJ use in libraries makes it's more important than
ever to make -Xreweavable the default option (or the compressed version).
Indeed, under what circumstances would we not want code to be reweavable? Is
the performance that much better? It seems to me that maybe reweavable
should just always be the case.

Failing that, I would like to see an option to weave into previously
non-reweavable woven code at a bytecode-level, which would just treat the
woven result like one would treat any Java bytecode (i.e., it wouldn't
recognize adviceexecution, nor understand ITD's, etc., it would operate on
the "machine-level" translation into Java bytecode).
 
Ron

Ron Bodkin
Chief Technology Officer
New Aspects of Software
w: (415) 824-4690
 
(*) Amusingly, I only discovered this because I had an error in the first
zip distribution I downloaded so I could only extract the debug jar file. 




Back to the top