Top Description Inners Fields Constructors Methods
org.aspectj.weaver.patterns

public abstract Class Pointcut

extends PatternNode
Class Inheritance
Known Direct Subclasses
org.aspectj.weaver.patterns.Pointcut.MatchesNothingPointcut, org.aspectj.weaver.patterns.ReferencePointcut, org.aspectj.weaver.patterns.CflowPointcut, org.aspectj.weaver.patterns.ConcreteCflowPointcut, org.aspectj.weaver.patterns.KindedPointcut, org.aspectj.weaver.patterns.NameBindingPointcut, org.aspectj.weaver.patterns.NotPointcut, org.aspectj.weaver.patterns.OrPointcut, org.aspectj.weaver.patterns.WithincodePointcut, org.aspectj.weaver.patterns.WithinPointcut, org.aspectj.weaver.internal.tools.PointcutDesignatorHandlerBasedPointcut, org.aspectj.weaver.patterns.AndPointcut, org.aspectj.weaver.patterns.HandlerPointcut, org.aspectj.weaver.patterns.IfPointcut, org.aspectj.weaver.patterns.PerClause
Imports
java.io.IOException, java.util.Map, org.aspectj.util.FuzzyBoolean, .TypeSafeEnum, org.aspectj.weaver.Advice, .AdviceKind, .BCException, .Checker, .CompressingDataOutputStream, .ISourceContext, .IntMap, .PoliceExtensionUse, .ResolvedType, .Shadow, .ShadowMunger, .UnresolvedType, .VersionedDataInputStream, .World, org.aspectj.weaver.ast.Literal, .Test

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

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

Authors
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 and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
public static class

Field Summary

Modifier and TypeField and Description
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final Pointcut.State
public static final String[]
public static final byte
protected boolean
public static final byte
public static final byte
public static final byte
public static final byte
protected int
private FuzzyBoolean
public 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.

public static final byte
public static final byte
public static final byte
protected byte
public static final byte
public static final Pointcut.State
public Pointcut.State
public static final Pointcut.State
public static final byte
private String[]
public static final byte
public static final byte
public static final byte
Inherited from org.aspectj.weaver.patterns.PatternNode:
endsourceContextstart

Constructor Summary

AccessConstructor and Description
public
Pointcut()

Constructor for Pattern.

Method Summary

Modifier and TypeMethod and Description
public void
public void
public final Pointcut
concretize(ResolvedType inAspect, ResolvedType declaringType, int arity)

Returns a new pointcut Only used by test cases

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

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

protected abstract Pointcut
concretize1(ResolvedType
the aspect to resolve relative to
inAspect
,
ResolvedType declaringType, IntMap
a Map from formal index in the current lexical context → formal index in the concrete advice that will run This must always return a new Pointcut object (even if the concretized Pointcut is identical to the resolved one). That behavior is assumed in many places. XXX fix implementors to handle state
bindings
)

Resolves and removes ReferencePointcuts, replacing with basic ones

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

public abstract FuzzyBoolean
fastMatch(FastMatchInfo info)

Could I match any shadows in the code defined within this type?

public final Test
findResidue(Shadow shadow, ExposedState state)

This can be called from NotPointcut even for Pointcuts that don't match the shadow

protected abstract Test
public static Pointcut
public byte
public String[]
public boolean
public static Pointcut
public final FuzzyBoolean
match(Shadow shadow)

Do I really match this shadow?

protected abstract FuzzyBoolean
public abstract Pointcut
public void
postRead(ResolvedType enclosingType)

public static Pointcut
public final Pointcut
resolve(IScope scope)

Returns this pointcut mutated

protected abstract void
resolveBindings(IScope scope, Bindings bindings)

public void
protected boolean
Inherited from org.aspectj.weaver.patterns.PatternNode:
acceptcopyLocationFromgetEndgetFileNamegetSourceContextgetSourceLocationgetStartreadLocationsetLocationtraversewritewriteLocation

Field Detail

ANDback to summary
public static final byte AND
ANNOTATIONback to summary
public static final byte ANNOTATION
ARGSback to summary
public static final byte ARGS
ATARGSback to summary
public static final byte ATARGS
ATTHIS_OR_TARGETback to summary
public static final byte ATTHIS_OR_TARGET
ATWITHINback to summary
public static final byte ATWITHIN
ATWITHINCODEback to summary
public static final byte ATWITHINCODE
CFLOWback to summary
public static final byte CFLOW
CONCRETEback to summary
public static final Pointcut.State CONCRETE
EMPTY_STRING_ARRAYback to summary
public static final String[] EMPTY_STRING_ARRAY
HANDLERback to summary
public static final byte HANDLER
hasBeenParameterizedback to summary
protected boolean hasBeenParameterized
IFback to summary
public static final byte IF
IF_FALSEback to summary
public static final byte IF_FALSE
IF_TRUEback to summary
public static final byte IF_TRUE
KINDEDback to summary
public static final byte KINDED
lastMatchedShadowIdback to summary
protected int lastMatchedShadowId
lastMatchedShadowResultback to summary
private FuzzyBoolean lastMatchedShadowResult
m_ignoreUnboundBindingForNamesback to summary
public 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

NONEback to summary
public static final byte NONE
NOTback to summary
public static final byte NOT
ORback to summary
public static final byte OR
pointcutKindback to summary
protected byte pointcutKind
REFERENCEback to summary
public static final byte REFERENCE
RESOLVEDback to summary
public static final Pointcut.State RESOLVED
stateback to summary
public Pointcut.State state
SYMBOLICback to summary
public static final Pointcut.State SYMBOLIC
THIS_OR_TARGETback to summary
public static final byte THIS_OR_TARGET
typeVariablesInScopeback to summary
private String[] typeVariablesInScope
USER_EXTENSIONback to summary
public static final byte USER_EXTENSION
WITHINback to summary
public static final byte WITHIN
WITHINCODEback to summary
public static final byte WITHINCODE

Constructor Detail

Pointcutback to summary
public Pointcut()

Constructor for Pattern.

Method Detail

assertStateback to summary
public void assertState(Pointcut.State state)
checkback to summary
public void check(ISourceContext ctx, World world)
concretizeback to summary
public final Pointcut concretize(ResolvedType inAspect, ResolvedType declaringType, int arity)

Returns a new pointcut Only used by test cases

concretizeback to summary
public final Pointcut concretize(ResolvedType inAspect, ResolvedType declaringType, int arity, ShadowMunger advice)
concretizeback to summary
public final Pointcut concretize(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings)
concretize1back to summary
protected abstract Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings)

Resolves and removes ReferencePointcuts, replacing with basic ones

Parameters
inAspect:ResolvedType

the aspect to resolve relative to

bindings:IntMap

a Map from formal index in the current lexical context → formal index in the concrete advice that will run This must always return a new Pointcut object (even if the concretized Pointcut is identical to the resolved one). That behavior is assumed in many places. XXX fix implementors to handle state

couldMatchKindsback to summary
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

fastMatchback to summary
public abstract FuzzyBoolean fastMatch(FastMatchInfo info)

Could I match any shadows in the code defined within this type?

findResidueback to summary
public final Test findResidue(Shadow shadow, ExposedState state)

This can be called from NotPointcut even for Pointcuts that don't match the shadow

findResidueInternalback to summary
protected abstract Test findResidueInternal(Shadow shadow, ExposedState state)
fromStringback to summary
public static Pointcut fromString(String str)
getPointcutKindback to summary
public byte getPointcutKind()
getTypeVariablesInScopeback to summary
public String[] getTypeVariablesInScope()
isDeclareback to summary
public boolean isDeclare(ShadowMunger munger)
makeMatchesNothingback to summary
public static Pointcut makeMatchesNothing(Pointcut.State state)
matchback to summary
public final FuzzyBoolean match(Shadow shadow)

Do I really match this shadow? XXX implementors need to handle state

matchInternalback to summary
protected abstract FuzzyBoolean matchInternal(Shadow shadow)
parameterizeWithback to summary
public abstract Pointcut parameterizeWith(Map<String, UnresolvedType> typeVariableMap, World w)
postReadback to summary
public void postRead(ResolvedType enclosingType)
readback to summary
public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException
resolveback to summary
public final Pointcut resolve(IScope scope)

Returns this pointcut mutated

resolveBindingsback to summary
protected abstract void resolveBindings(IScope scope, Bindings bindings)
setTypeVariablesInScopeback to summary
public void setTypeVariablesInScope(String[] typeVars)
shouldCopyLocationForConcretizeback to summary
protected boolean shouldCopyLocationForConcretize()
org.aspectj.weaver.patterns back to summary

pack-priv Class Pointcut.MatchesNothingPointcut

extends Pointcut
Class Inheritance

Field Summary

Inherited from org.aspectj.weaver.patterns.Pointcut:
ANDANNOTATIONARGSATARGSATTHIS_OR_TARGETATWITHINATWITHINCODECFLOWCONCRETEEMPTY_STRING_ARRAYHANDLERhasBeenParameterizedIFIF_FALSEIF_TRUEKINDEDlastMatchedShadowIdm_ignoreUnboundBindingForNamesNONENOTORpointcutKindREFERENCERESOLVEDstateSYMBOLICTHIS_OR_TARGETUSER_EXTENSIONWITHINWITHINCODE

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Object
public Pointcut
concretize1(ResolvedType
the aspect to resolve relative to
inAspect
,
ResolvedType declaringType, IntMap
a Map from formal index in the current lexical context → formal index in the concrete advice that will run This must always return a new Pointcut object (even if the concretized Pointcut is identical to the resolved one). That behavior is assumed in many places. XXX fix implementors to handle state
bindings
)

Implements abstract org.aspectj.weaver.patterns.Pointcut.concretize1.

Resolves and removes ReferencePointcuts, replacing with basic ones
public int
couldMatchKinds()

Implements abstract org.aspectj.weaver.patterns.Pointcut.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
public FuzzyBoolean
fastMatch(FastMatchInfo type)

Implements abstract org.aspectj.weaver.patterns.Pointcut.fastMatch.

Could I match any shadows in the code defined within this type?
protected Test
protected FuzzyBoolean
public Pointcut
public void
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
Inherited from org.aspectj.weaver.patterns.Pointcut:
assertStatecheckconcretizeconcretizeconcretizefindResiduefromStringgetPointcutKindgetTypeVariablesInScopeisDeclaremakeMatchesNothingmatchreadresolvesetTypeVariablesInScopeshouldCopyLocationForConcretize

Constructor Detail

MatchesNothingPointcutback to summary
pack-priv MatchesNothingPointcut()

Method Detail

acceptback to summary
public Object accept(PatternNodeVisitor visitor, Object data)

Implements abstract org.aspectj.weaver.patterns.PatternNode.accept.

Annotations
@Override
concretize1back to summary
public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings)

Implements abstract org.aspectj.weaver.patterns.Pointcut.concretize1.

Doc from org.aspectj.weaver.patterns.Pointcut.concretize1.

Resolves and removes ReferencePointcuts, replacing with basic ones

Parameters
inAspect:ResolvedType

the aspect to resolve relative to

bindings:IntMap

a Map from formal index in the current lexical context → formal index in the concrete advice that will run This must always return a new Pointcut object (even if the concretized Pointcut is identical to the resolved one). That behavior is assumed in many places. XXX fix implementors to handle state

Annotations
@Override
couldMatchKindsback to summary
public int couldMatchKinds()

Implements abstract org.aspectj.weaver.patterns.Pointcut.couldMatchKinds.

Doc from org.aspectj.weaver.patterns.Pointcut.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

Annotations
@Override
fastMatchback to summary
public FuzzyBoolean fastMatch(FastMatchInfo type)

Implements abstract org.aspectj.weaver.patterns.Pointcut.fastMatch.

Doc from org.aspectj.weaver.patterns.Pointcut.fastMatch.

Could I match any shadows in the code defined within this type?

Annotations
@Override
findResidueInternalback to summary
protected Test findResidueInternal(Shadow shadow, ExposedState state)

Implements abstract org.aspectj.weaver.patterns.Pointcut.findResidueInternal.

Annotations
@Override
matchInternalback to summary
protected FuzzyBoolean matchInternal(Shadow shadow)

Implements abstract org.aspectj.weaver.patterns.Pointcut.matchInternal.

Annotations
@Override
parameterizeWithback to summary
public Pointcut parameterizeWith(Map<String, UnresolvedType> typeVariableMap, World w)

Implements abstract org.aspectj.weaver.patterns.Pointcut.parameterizeWith.

Annotations
@Override
postReadback to summary
public void postRead(ResolvedType enclosingType)

Overrides org.aspectj.weaver.patterns.Pointcut.postRead.

Annotations
@Override
resolveBindingsback to summary
public void resolveBindings(IScope scope, Bindings bindings)

Implements abstract org.aspectj.weaver.patterns.Pointcut.resolveBindings.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
writeback to summary
public void write(CompressingDataOutputStream s) throws IOException

Implements abstract org.aspectj.weaver.patterns.PatternNode.write.

Annotations
@Override
org.aspectj.weaver.patterns back to summary

public final Class Pointcut.State

extends TypeSafeEnum
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
State(String name, int key)

Method Summary

Inherited from org.aspectj.util.TypeSafeEnum:
equalsgetKeygetNamehashCodetoStringwrite

Constructor Detail

Stateback to summary
public State(String name, int key)