Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] aspectJ compiler crashes - is this a bug?

Nick is right: args can match adviceexecution (so the original advice would result in an infinite loop at runtime if the compiler didn't have the bug). 

The reason why the fixed version prints out twice is that both the method execution and method call join points are matched. 

By the way, the original example code also crashes the latest ajc compiler from CVS HEAD.

I don't think it's ever good style to write advice (or declare warning etc.) on just args; the only case I could think of is if you want to make sure of constraints or rules whenever you pass some class of objects into a subsystem. But even there, I think it's better form to explicitly list method call (or execution), to avoid picking out unexpected things (like adviceexecution or field access).

Ron

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

> ------------Original Message------------
> From: Nicholas Lesiecki <ndlesiecki@xxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Fri, Mar-5-2004 7:50 AM
> Subject: Re: [aspectj-users] aspectJ compiler crashes - is this a bug?
> 
> My guess is that args(int, int) is affecting the adviceexecution join  
> point because of the arguments passed to the advice. Hence  
> !within(oops) fixes it. In any case, the compiler should never crash.  
> I'd submit a bug...
> 
> Cheers,
> Nick
> On Mar 5, 2004, at 8:03 AM, JITESH KALYANI Shivanand wrote:
> 
> > HI,
> >
> > You will have to modify your apsect code as follows,
> >
> > But its executing advice code twice, I do not know why?
> >
> > aspect oops {
> >
> >     pointcut args_only(int a, float b) : args(a, b);
> >
> >     after(int a, float b) :  !within(oops) && args_only(a, b) {
> > 		System.out.println("After args : a = "+a+" :b = "+b);
> > 	}
> >   }
> >
> > class test
> > {
> > 	public static void main(String[] args)
> > 	{
> > 		test obj = new test();
> > 		int a = obj.f(10,3);
> > 	}
> >
> > 	public int f(int a, float s) {
> > 		System.out.println("Inside test.f()");
> > 		return 1;
> > 	}
> >
> > }
> >
> > Jitesh
> >
> >> ----------
> >> From:  
> >> 	aspectj-users-admin@xxxxxxxxxxx[SMTP:aspectj-users- 
> >> admin@xxxxxxxxxxx] on behalf of Devi Prasad[SMTP:dpstorms@xxxxxxxxx]
> >> Reply To: 	aspectj-users@xxxxxxxxxxx
> >> Sent: 	Friday, March 05, 2004 7:44 PM
> >> To: 	aspectj-users@xxxxxxxxxxx; aspectj-dev@xxxxxxxxxxx
> >> Subject: 	[aspectj-users] aspectJ compiler crashes - is this a bug?
> >>
> >> Hi
> >>    while experimenting with aspectJ 1.1.1, I found
> >> that the compiler crashes while compiling this tiny
> >> piece of code. The compiler produces a dump saying
> >> that this could be a bug.
> >> Can someone clarify why the compiler is crashing? I
> >> havent' included the compiler dump because this is a
> >> very small piece of code:
> >>
> >> -----------------------------------------------------
> >>   class test {
> >>     public int f(int a, float s) { return 1; }
> >>   }
> >>
> >>   aspect oops {
> >>     pointcut args_only() : args(int, int);
> >>
> >>     after() : args_only() {
> >>     }
> >>   }
> >> -----------------------------------------------------
> >>
> >> Thanks
> >>
> >>
> >> __________________________________
> >> Do you Yahoo!?
> >> Yahoo! Search - Find what you're looking for faster
> >> http://search.yahoo.com
> >> _______________________________________________
> >> 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
> >
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 


Back to the top