[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] Infinite advice call problem
|
Title: RE: [aspectj-users] Infinite advice call problem
Hi Robert
within refers to code that is literally inside your aspect. You don't have any calls to new
in Constructor, only a call to clone. In order to capture the _control flow_ through clone to new,
you need to use cflow (or to be precise !cflow).
Changing
!within(Constructor) {
to
!cflow(Constructor) {
should do the trick.
Elizabeth
-----Original Message-----
From: Robert Wenner [mailto:robert@xxxxxxxxxx]
Sent: Tuesday January 07, 2003 4:14 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] Infinite advice call problem
Hi,
I have the problem of infinite advice calls as described in FAQ item
11.1; running the program below crashes the VM with a memory fault
(hence the class name).
According to the FAQ answer I could use after returning instead of
plain after to handle exceptions different from normal method
execution, or I could use !within(theAspect). Neither works for me,
i.e. neither changes the program behaviour.
I understand that the after returning does not have any impact on the
sample code as nothing is thrown.
But why doesnt !within work? Is this a problem due to indirect
recursion?
What am I missing?
Thanks in advance,
Robert
class MemoryFault {
public static void main(String args[]) {
MemoryFault mf = new MemoryFault();
}
public Object clone() {
return new MemoryFault();
}
}
aspect Constructor {
after(MemoryFault mf):
target(mf) &&
execution(MemoryFault.new(..)) &&
!within(Constructor) {
// System.out.println("In after() advice");
MemoryFault other = (MemoryFault) mf.clone();
}
}
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users