Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] can we joinpoint on 'java.lang.Object'

Hi Guys

Being new to aspectJ, I came across another problem and would highly
appreciate any suggestions or comments on this issue.

Basically what I need to do is to put some "pointcut" on any_java_object,
so "java.lang.Object" at "constructor execution" join point.So.. is this
correct "execution(*.new())".?

I tried with a very simple aspect WHICH_DOES_NOT_SEEM to work for me. It
was throwing NoClassDefFoundError, obviously I tried to decompile the
class file where it was complaining and checked up the line number (there
was this import org.aspectj.runtime.reflect.Factory ).I also checked the
rt.jar I have in the classpath does indeed have this class file.?? To add
to the mystery, if I dont use pointcut on "java.lang.object" and instead
use on say one of my specialized class then everything is fine and there
are no issue. So, I am not sure how far this error mmessage is correct as
I seem to be stuck with options :

Any help will be highly greatful.

public aspect PostAspect {

    pointcut verify(java.lang.Object o) : execution(*.new()) && this(o);

    before(java.lang.Object o) : verify(o) {
	    System.out.println("[Aspect] before() : "+thisJoinPoint);
    }

    after(java.lang.Object o) : verify(o){
        System.out.println("[Aspect] after() : "+thisJoinPoint);
    }
}

Thanks...
Tarun
-- 
  Tarun Sharma
  t_sharma@xxxxxxxxxxxx

-- 
http://www.fastmail.fm - Consolidate POP email and Hotmail in one place


Back to the top