[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] can we joinpoint on 'java.lang.Object'
|
Hey Nick
Cheers man and thanks again, for your time.
Thanks
Tarun
On Sat, 30 Aug 2003 09:45:33 -0700, "Nicholas Lesiecki"
<ndlesiecki@xxxxxxxxx> said:
> Tarun,
>
> Glad I could help.
>
> > Hmmm... so aspect itself could be advised.? Thats
> > good to know.
>
> Yep. This is one of the most common surprises for a new user of AspectJ.
>
> For more information on these and other common "gotchas" see:
>
> Mastering AspectJ (by yours truly):
> http://tinyurl.com/66vf
>
> AspectJ in Action (by Ramnivas Laddad)
> http://www.amazon.com/exec/obidos/tg/detail/-/1930110936
>
> The AspectJ FAQ, (which you've probably already read)
> http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/faq
> .html
>
> Cheers,
>
> Nick
> On 8/30/03 4:50 AM, "Tarun Sharma" <t_sharma@xxxxxxxxxxxx> wrote:
>
> > 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
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
--
Tarun Sharma
t_sharma@xxxxxxxxxxxx
--
http://www.fastmail.fm - The way an email service should be