[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Some comments about the documentations
|
Hello,
I looked at the programming guide in the aspectJ documentations online,
and I have a couple of comments (I don't know if they should be
classified as errors or not):
1) In appendix B, heading "Pointcuts", sub-heading "Primitive
pointcuts", there is the following example:
aspect GuardedX {
static final int MAX_CHANGE = 100;
before(int newval): set(int T.x) && args(newval) {
if (Math.abs(newval - T.x) > MAX_CHANGE)
throw new RuntimeException();
}
}
I believe that this example is misleading, because it requires the field
x of class T to be declared as a static field. Using ajdt, I tried to
run this example (by creating a simple class T with field x) but it
didn't work. Making the field static solved the problem.
I think that the confusing arises because in the first occurrence of T.x
(in the point-cut portion of the advice declaration) it doesn't matter
whether x is static or not. However, in the second occurrence it does
matter.
2) In section 1, heading "Development Aspects", sub heading "Contract
Enforement", there is an example that declares a static aspect. To the
best of my knowledge, the keyword "static", when used before an aspect
declaration, declares the aspect to be a subclass of another class
(similarly to the static class declarations in Java). However, the
problem that I want to point out is that this is not mentioned anyway in
the documentations (or at least I couldn't find it), and this issue
puzzled me for a while.
Thanks,
Jonathan