Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] cflow or something like that

Robert,

If you aren't able to weave into the code of A, I think you will either have to resort to looking at the stack trace at some point or use some non-AspectJ-specific way to identify when A is running (e.g., with a subclass or a decorator or a servlet filter). If you are looking at stack traces, it might be more efficient to do it at a top-level entry point rather than at each execution of B.

Ron

Ron Bodkin
Chief Technology Officer
New Aspects of Software
o: (415) 824-4690
m: (415) 509-2895

> ------------Original Message------------
> From: robert kuzelj <robert_kuzelj@xxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Tue, Jul-13-2004 7:45 AM
> Subject: Re: [aspectj-users] cflow or something like that
> 
> Jeffrey D Palm wrote:
> > robert kuzelj wrote:
> > 
> >> hi,
> >>
> >> how do i solve the following situation
> >>
> >> i have two class
> >> class A{public void executeA(){...}}
> >> class B{public void executeB(){...}}
> >>
> >> what i want to do is to get the execution
> >> of B.executeB but only if its called
> >> by A. the problem thou is that executeB
> >> is never directly called by A thou its
> >> somewhere in the callstack.
>  >
>  > Does this work for you?
> 
> nope!
> 
> but there is one important piece of information
> i forgot in my previous mail.
> 
> class A is not available in source code to me.
> its a jar file i cannot weave into.
> 
> ciao robertj
> 
> 
> > 
> > public class Bob {
> > 
> >   static class A{void executeA(){ System.out.println("A"); c(); }}
> >   static class B{void executeB(){ System.out.println("B");      }}
> >   static void c() { new B().executeB(); }
> > 
> >   static aspect Aspect {
> >     pointcut p(): execution(* B.executeB())
> >                && cflow(execution(* A.executeA()));
> >     before(): p() { System.out.println(thisJoinPoint); }
> >   }
> > 
> >   public static void main(String[] args) {
> >     new A().executeA();
> >     new B().executeB();
> >     c();
> >   }
> > }
> > 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 


Back to the top