[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Instrumenting System Classes from aspectj
|
Hi,
Thanks for the response. I have wrapped the constructor to the Thread
class as follows:
------------------
public aspect AddTaintVarToThread {
after() : execution(new(..)) && this(Thread) {
//throw new IllegalStateException("Should never be
constructing a bad type");
System.out.println("Hurray! Thread advice works!");
}
}
--------------------------
I compiled it using ajc as follows:
ajc -1.5 -cp /u/suman/installs/aspectj1.6/lib/aspectjrt.jar
-inpath /usr/lib/jvm/java-1.5.0-sun/jre/lib/rt.jar
-Xmx1500M -XX:PermSize=640M -XX:MaxPermSize=1280M
-d ./build
-outjar rt.jar src/*.aj src/*.java
I think the wrapping worked because, the decompiled versions of the
original thread class and the new thread class were different.
The compile worked fine but, when I run my application I get the
following error:
---------------------------------------------------------------------
cd /home/suman/exercise/steve_rnr/ytrace/ytrace_examples/Examples/build ;
java -Xbootclasspath/p:. -cp
/u/suman/installs/aspectj1.6//lib/aspectjweaver.jar:. BankExample
Error occurred during initialization of VM
java.lang.NullPointerException
make: *** [client] Error 1
-------------------------------------------------------------------------
I tried googling but found no pointers to why this happens. Am I
missing something? Any pointers will be helpful.
TIA,
-S-
PS: I made sure that I am loading the generated classes by switching
on the verbose mode.
On Thu, Jun 26, 2008 at 12:05 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
> Have you placed rt.jar (windows) or classes.jar (mac) on your in path?
> Classes on the in path are fed to the weaver and rewoven with all
> aspects in the project. This should work.
>
> Since the jar is quite large, you may want to add extra heap space to
> your compiler (ie- if running in eclipse then add the following vm
> arguments to the command line to run eclipse: -vmargs -Xmx764M
> -XX:PermSize=64M -XX:MaxPermSize=128M)
>
> On Thu, Jun 26, 2008 at 8:42 AM, 100ji <itz100ji@xxxxxxxxx> wrote:
>> Hi all,
>>
>> I am relatively new to aspectj. I tried writing an aspect to
>> instrument java.lang.String, but the eclipse IDE tells me that the
>> class is not exposed (even tried using privileged aspect). So, I want
>> to know if there is a way to instrument system classes from aspectj? I
>> want to instrument java.lang.String and other such classes. Any
>> pointers will be helpful.
>>
>> Thanks for your time,
>> -S-
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>