Using args(...) in a Pointcut [message #16871] |
Wed, 26 February 2003 14:40 |
Eclipse User |
|
|
|
The on-line AspectJ Programming Guide includes the following example on
page 11
aspect PointBoundsChecking {
...
pointcut setY(int y):
(call(void FigureElement.setXY(int, int)) && args(*, y))
|| (call(void Point.setY(int)) && args(y));
...
before(int y): setY(y) {
if ( y < MIN_Y || y > MAX_Y )
throw new IllegalArgumentException("y is out of bounds.");
}
}
The PDF manual has (note how args is done)
aspect PointBoundsChecking {
...
pointcut setY(int y):
(call(void FigureElement.setXY(int, int)) ||
call(void Point.setY(int)))
&& args(y, ..));
...
before(int y): setY(y) {
if ( y < MIN_Y || y > MAX_Y )
throw new IllegalArgumentException("y is out of bounds.");
}
}
I can't see how the Aspect compiler could possibly know which argument to
setXY() was 'y'. Is the PDF manual simply wrong, and should I do things as
in the on-line manual?
|
|
|
Powered by
FUDForum. Page generated in 0.03254 seconds