Skip to main content

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

Hi Nick

Bingo.! right on target. You were absolutely correct and thanks for the
picking the problem. Hmmm... so aspect itself could be advised.? Thats
good to know.

Thanks sooo much Nick for your help.

Cheers
Tarun


On Sat, 30 Aug 2003 01:03:24 -0700, "Nicholas Lesiecki"
<ndlesiecki@xxxxxxxxx> said:
> Tarun,
> 
> Without further information, I would guess that *.new() is not what you
> want. Why? Because it will end up advising the constructors of the
> objects
> that AspectJ uses to do its work. This creates a problem. The aspect must
> be
> constructed to advise any join points, but it cannot be constructed
> without
> executing the advice. Try excluding the aspect in question using
> !within(PostAspect).
> 
> Cheers,
> Nick
> 
> On 8/29/03 8:17 PM, "Tarun Sharma" <t_sharma@xxxxxxxxxxxx> wrote:
> 
> > 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
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
-- 
  Tarun Sharma
  t_sharma@xxxxxxxxxxxx

-- 
http://www.fastmail.fm - A fast, anti-spam email service.


Back to the top