Table of Contents
Many of the extensions to the AspectJ language to address the new features of Java 5 are derived from a simple set of principles for join point matching. In this section, we outline these principles as a foundation for understanding the matching rules in the presence of annotations, generics, covariance, varargs, and autoboxing.
AspectJ supports 11 different kinds of join points. These are the method call, method execution, constructor call, constructor execution, field get, field set, pre-initialization, initialization, static initialization, handler, and advice execution join points.
The kinded pointcut designators match based on the kind of a join point. These are the call, execution, get, set, preinitialization, initialization, staticinitialization, handler, and adviceexecution designators.
A kinded pointcut is written using patterns, some of which match based on signature, and some of which match based on modifiers. For example, in the call pointcut designator:
call(ModifierPattern TypePattern TypePattern.IdPattern(TypePatternList) ThrowsPattern)
the modifiers matching patterns are ModifierPattern and ThrowsPattern, and the signature matching patterns are TypePattern TypePattern.IdPattern(TypePatternList).
A join point has potentially multiple signatures, but only one set of modifiers. A kinded primitive pointcut matches a particular join point if and only if:
These rules make it very easily to quickly determine whether a given pointcut matches a given join point. In the next two sections, we describe what the signature(s) of a join point are, and what the subjects of join points are.