org.aspectj.weaver.patterns
Class Pointcut

java.lang.Object
  extended by org.aspectj.weaver.patterns.PatternNode
      extended by org.aspectj.weaver.patterns.Pointcut
All Implemented Interfaces:
IHasPosition, IHasSourceLocation
Direct Known Subclasses:
AndPointcut, CflowPointcut, ConcreteCflowPointcut, HandlerPointcut, IfPointcut, KindedPointcut, NameBindingPointcut, NotPointcut, OrPointcut, PerClause, PointcutDesignatorHandlerBasedPointcut, ReferencePointcut, WithincodePointcut, WithinPointcut

public abstract class Pointcut
extends PatternNode

The lifecycle of Pointcuts is modeled by Pointcut.State. It has three things:

Creation -- SYMBOLIC -- then resolve(IScope) -- RESOLVED -- concretize(...) -- CONCRETE

Author:
Erik Hilsdale, Jim Hugunin A day in the life of a pointcut.... - AMC. ========================================== Pointcuts are created by the PatternParser, which is called by ajdt to parse a pointcut from the PseudoTokens AST node (which in turn are part of a PointcutDesignator AST node). Pointcuts are resolved by ajdt when an AdviceDeclaration or a PointcutDeclaration has its statements resolved. This happens as part of completeTypeBindings in the AjLookupEnvironment which is called after the diet parse phase of the compiler. Named pointcuts, and references to named pointcuts are instances of ReferencePointcut. At the end of the compilation process, the pointcuts are serialized (write method) into attributes in the class file. When the weaver loads the class files, it unpacks the attributes and deserializes the pointcuts (read). All aspects are added to the world, by calling addOrReplaceAspect on the crosscutting members set of the world. When aspects are added or replaced, the crosscutting members in the aspect are extracted as ShadowMungers (each holding a pointcut). The ShadowMungers are concretized, which concretizes the pointcuts. At this stage ReferencePointcuts are replaced by their declared content. During weaving, the weaver processes type by type. It first culls potentially matching ShadowMungers by calling the fastMatch method on their pointcuts. Only those that might match make it through to the next phase. At the next phase, all of the shadows within the type are created and passed to the pointcut for matching (match). When the actual munging happens, matched pointcuts are asked for their residue (findResidue) - the runtime test if any. Because of negation, findResidue may be called on pointcuts that could never match the shadow.

Nested Class Summary
static class Pointcut.State
           
 
Field Summary
static byte AND
           
static byte ANNOTATION
           
static byte ARGS
           
static byte ATARGS
           
static byte ATTHIS_OR_TARGET
           
static byte ATWITHIN
           
static byte ATWITHINCODE
           
static byte CFLOW
           
static Pointcut.State CONCRETE
           
static java.lang.String[] EMPTY_STRING_ARRAY
           
static byte HANDLER
           
static byte IF
           
static byte IF_FALSE
           
static byte IF_TRUE
           
static byte KINDED
           
 java.lang.String[] m_ignoreUnboundBindingForNames
          ATAJ the name of the formal for which we don't want any warning when unbound since we consider them as implicitly bound.
static byte NONE
           
static byte NOT
           
static byte OR
           
static byte REFERENCE
           
static Pointcut.State RESOLVED
           
 Pointcut.State state
           
static Pointcut.State SYMBOLIC
           
static byte THIS_OR_TARGET
           
static byte USER_EXTENSION
           
static byte WITHIN
           
static byte WITHINCODE
           
 
Constructor Summary
Pointcut()
          Constructor for Pattern.
 
Method Summary
 void assertState(Pointcut.State state)
           
 void check(ISourceContext ctx, World world)
           
 Pointcut concretize(ResolvedType inAspect, ResolvedType declaringType, int arity)
          Returns a new pointcut Only used by test cases
 Pointcut concretize(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings)
           
 Pointcut concretize(ResolvedType inAspect, ResolvedType declaringType, int arity, ShadowMunger advice)
           
abstract  int couldMatchKinds()
          The set of ShadowKinds that this Pointcut could possibly match - an int whose bits are set according to the Kinds specified in Shadow.java
abstract  FuzzyBoolean fastMatch(FastMatchInfo info)
          Could I match any shadows in the code defined within this type?
 Test findResidue(Shadow shadow, ExposedState state)
          This can be called from NotPointcut even for Pointcuts that don't match the shadow
static Pointcut fromString(java.lang.String str)
           
 byte getPointcutKind()
           
 java.lang.String[] getTypeVariablesInScope()
           
 boolean isDeclare(ShadowMunger munger)
           
static Pointcut makeMatchesNothing(Pointcut.State state)
           
 FuzzyBoolean match(Shadow shadow)
          Do I really match this shadow? XXX implementors need to handle state
abstract  Pointcut parameterizeWith(java.util.Map<java.lang.String,UnresolvedType> typeVariableMap, World w)
           
 void postRead(ResolvedType enclosingType)
           
static Pointcut read(VersionedDataInputStream s, ISourceContext context)
           
 Pointcut resolve(IScope scope)
          Returns this pointcut mutated
 void setTypeVariablesInScope(java.lang.String[] typeVars)
           
 
Methods inherited from class org.aspectj.weaver.patterns.PatternNode
accept, copyLocationFrom, getEnd, getFileName, getSourceContext, getSourceLocation, getStart, readLocation, setLocation, traverse, write, writeLocation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_ignoreUnboundBindingForNames

public java.lang.String[] m_ignoreUnboundBindingForNames
ATAJ the name of the formal for which we don't want any warning when unbound since we consider them as implicitly bound. f.e. JoinPoint for @AJ advices


EMPTY_STRING_ARRAY

public static final java.lang.String[] EMPTY_STRING_ARRAY

SYMBOLIC

public static final Pointcut.State SYMBOLIC

RESOLVED

public static final Pointcut.State RESOLVED

CONCRETE

public static final Pointcut.State CONCRETE

state

public Pointcut.State state

KINDED

public static final byte KINDED
See Also:
Constant Field Values

WITHIN

public static final byte WITHIN
See Also:
Constant Field Values

THIS_OR_TARGET

public static final byte THIS_OR_TARGET
See Also:
Constant Field Values

ARGS

public static final byte ARGS
See Also:
Constant Field Values

AND

public static final byte AND
See Also:
Constant Field Values

OR

public static final byte OR
See Also:
Constant Field Values

NOT

public static final byte NOT
See Also:
Constant Field Values

REFERENCE

public static final byte REFERENCE
See Also:
Constant Field Values

IF

public static final byte IF
See Also:
Constant Field Values

CFLOW

public static final byte CFLOW
See Also:
Constant Field Values

WITHINCODE

public static final byte WITHINCODE
See Also:
Constant Field Values

HANDLER

public static final byte HANDLER
See Also:
Constant Field Values

IF_TRUE

public static final byte IF_TRUE
See Also:
Constant Field Values

IF_FALSE

public static final byte IF_FALSE
See Also:
Constant Field Values

ANNOTATION

public static final byte ANNOTATION
See Also:
Constant Field Values

ATWITHIN

public static final byte ATWITHIN
See Also:
Constant Field Values

ATWITHINCODE

public static final byte ATWITHINCODE
See Also:
Constant Field Values

ATTHIS_OR_TARGET

public static final byte ATTHIS_OR_TARGET
See Also:
Constant Field Values

NONE

public static final byte NONE
See Also:
Constant Field Values

ATARGS

public static final byte ATARGS
See Also:
Constant Field Values

USER_EXTENSION

public static final byte USER_EXTENSION
See Also:
Constant Field Values
Constructor Detail

Pointcut

public Pointcut()
Constructor for Pattern.

Method Detail

fastMatch

public abstract FuzzyBoolean fastMatch(FastMatchInfo info)
Could I match any shadows in the code defined within this type?


couldMatchKinds

public abstract int couldMatchKinds()
The set of ShadowKinds that this Pointcut could possibly match - an int whose bits are set according to the Kinds specified in Shadow.java


getTypeVariablesInScope

public java.lang.String[] getTypeVariablesInScope()

setTypeVariablesInScope

public void setTypeVariablesInScope(java.lang.String[] typeVars)

match

public final FuzzyBoolean match(Shadow shadow)
Do I really match this shadow? XXX implementors need to handle state


getPointcutKind

public byte getPointcutKind()

resolve

public final Pointcut resolve(IScope scope)
Returns this pointcut mutated


concretize

public final Pointcut concretize(ResolvedType inAspect,
                                 ResolvedType declaringType,
                                 int arity)
Returns a new pointcut Only used by test cases


concretize

public final Pointcut concretize(ResolvedType inAspect,
                                 ResolvedType declaringType,
                                 int arity,
                                 ShadowMunger advice)

isDeclare

public boolean isDeclare(ShadowMunger munger)

concretize

public final Pointcut concretize(ResolvedType inAspect,
                                 ResolvedType declaringType,
                                 IntMap bindings)

findResidue

public final Test findResidue(Shadow shadow,
                              ExposedState state)
This can be called from NotPointcut even for Pointcuts that don't match the shadow


postRead

public void postRead(ResolvedType enclosingType)

read

public static Pointcut read(VersionedDataInputStream s,
                            ISourceContext context)
                     throws java.io.IOException
Throws:
java.io.IOException

check

public void check(ISourceContext ctx,
                  World world)

fromString

public static Pointcut fromString(java.lang.String str)

makeMatchesNothing

public static Pointcut makeMatchesNothing(Pointcut.State state)

assertState

public void assertState(Pointcut.State state)

parameterizeWith

public abstract Pointcut parameterizeWith(java.util.Map<java.lang.String,UnresolvedType> typeVariableMap,
                                          World w)