Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: RE: using AspectJ with rt.jar

I defined a pointcut at the execution of a method in rt.jar:
    pointcut execToString() : execution(* *..Object.toString(..));

I applied a "before" advice on this pointcut:
    before() : execToString()
    {
        System.out.println("Instrumenting toString in Object class");
    }

Of course I have a method that does the following:
    Object obj = new Object();
    obj.toString();

I tried compile-time weaving, post-compile weaving and load-time weaving, I was not getting the message printed at all, and I think the Object.toString() method was not applied with aspect.  
However if I change "execution" to "call" in the pointcut definition, I see the message get printed.  I have a feeling that aspectJ can only apply aspects on my own application classes, not the classes in rt.jar.

Can you please carify this for me please?  If we can actually apply aspects on classes in rt.jar, how can I do that?  I'd really appreciate this.  Thanks a lot.

Joanne

Sent from the AspectJ - users forum at Nabble.com.

Back to the top