Most of the pointcut designators match based on signatures, and hence are unaffected by autoboxing. For example, a call to a method
public void foo(Integer i);
is not matched by a pointcut
call(void foo(int))
since the signature declares
a single Integer
parameter, not an int
.
The args
pointcut designator is affected by
autoboxing since it matches based on the runtime type of the arguments.
AspectJ 5 applies autoboxing and unboxing in determining argument matching.
In other words, args(Integer)
will match any join
point at which there is a single argument of type Integer
or of type int
.
Autoboxing and unboxing are also applied when binding pointcut or advice parameters, for example:
pointcut foo(int i) : args(i); before(Integer i) : foo(i) { ... }