[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] non-initialization set/get join points
|
Hi all,
I have another interesting situation I want express, which I believe is
not possible and I just want to check:
Basically, I want to capture all set/get join points which are not part
of the initialization of the target object. e.g.
class test {
private int x;
test() {
x = 0; // don't want to catch this
}
}
So, I first thought of the following advice:
before(): (get(* *.*) || set(* *.*)) && !withincode(*.new(..)) {
...
}
But. there are two distinct issues with this:
1) it hides sets/gets to one object from within the constructor of another.
2) it does not help in the following case:
class test {
private int x;
test() { helperfn(); }
private helperfn() { x = 0; } // will be caught
}
So. ignoring the first problem, I thought to try and extend my pointcut
as follows:
before(): (get(* *.*) || set(* *.*)) && !withincode(*.new(..)) &&
!cflow(*.new(..)) {
...
}
But. I was surprised to find that this does not compile, because (I
believe) cflow needs a definite function (i.e. no "*.").
So, at this point I'm out of ideas. But, is there anything I've missed?
Cheers,
David J. Pearce