[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW for bootstap classes

Thanks, Ron.

I think that large parts of AspectJ's documentation need updating - and
no, I am not volunteering, because I am still just a slightly advanced
beginner at best. I several places there are phrases like: "In v1.0 this
is so-and-so, in 1.1 we intend to do it like this."

In this particular case the piece of documentation I quoted is
inaccurate and creates misunderstandings. I think it is similar in
several other places. Anyway, you clarified this issue for me, and I am
fine with doing it via reflection for the time being. It actually works
like a charm already. Good hint, thanks. :-)

Regards
--
Alexander Kriegisch



Ron Bodkin schrieb:
> Hi Alexander,
> 
> At this time AspectJ won't apply load-time weaving to bootstrap-loaded
> classes at all. It should be possible to do so for a fairly large subset of
> classes, but it would require changing (and testing!) the AspectJ code base
> so that the LTW system handles null ClassLoaders correctly everywhere. For
> calling a non-public method, I'd suggest you try using reflection,
> specifically get that method and invoke setAccessible(true) to allow calling
> it. For other uses of aspects with the bootstrap loader, you might consider
> using call pointcuts with LTW or in the worst case preprocessing the
> bootstrap classes to weave them.
> 
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Alexander Kriegisch
> Sent: Saturday, February 03, 2007 9:36 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: [aspectj-users] LTW for bootstap classes
> 
> I read the following in the AspectJ 5 LTW documentation
> (http://www.eclipse.org/aspectj/doc/released/devguide/ltw-specialcases.html)
> :
> 
>> The following classes are not exposed to the LTW infrastructure 
>> regardless of the aop.xml file(s) used:
>>
>> - All org.aspectj.* classes (and subpackages) - as those are needed
>> by the infrastructure itself
>>
>> - All java.* and javax.* classes (and subpackages)
>>
>> - All sun.reflect.* classes - as those are JDK specific classes used 
>> when reflective calls occurs
> 
> Having understood that much, I thought that I might give some other
> classes inside rt.jar a try. Specifically, I tried to call the
> non-public constructor
> 
> sun.security.rsa.RSAPrivateKeyImpl(BigInteger, BigInteger)
> 
> from a  privileged aspect.
> 
> I suddeed doing so by weaving into the classfiles, producing copies of
> all JRE bootstrap classes in my project's 'bin' directory. but that is
> not what I want, because I would much prefer to tackle the challenge
> using LTW. It just won't work, though.
> 
> I would appreciate hints concerning the following questions:
>   - Can it be done by LTW at all?
>   - If so, how? I want to call the constructor and assign the resulting
>     object to a member of another regular Java class, so it can work
>     with that instance.
>   - Last, but not least, I would like to do this from Eclipse 3.2 with
>     AJDT installed. I could not come up with a project and start
>     configuration properly addressing this issue.
> 
> Regards