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

public Class SignaturePattern

extends PatternNode
implements ISignaturePattern
Class Inheritance
All Implemented Interfaces
org.aspectj.weaver.patterns.ISignaturePattern
Imports
java.io.IOException, java.util.ArrayList, .Collection, .Collections, .HashMap, .List, .Map, .Set, org.aspectj.bridge.ISourceLocation, org.aspectj.util.FuzzyBoolean, org.aspectj.weaver.AjAttribute, .AjcMemberMaker, .AnnotationTargetKind, .CompressingDataOutputStream, .ConcreteTypeMunger, .ISourceContext, .JoinPointSignature, .JoinPointSignatureIterator, .Member, .MemberKind, .NewFieldTypeMunger, .ResolvableTypeList, .ResolvedMember, .ResolvedType, .UnresolvedType, .VersionedDataInputStream, .World

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
SignaturePattern.TypePatternVisitor

Class which visits the nodes in the TypePattern tree until an ExactTypePattern is found.

Field Summary

Modifier and TypeField and Description
private AnnotationTypePattern
private int
private static final int
private TypePattern
private transient int
private transient boolean
private MemberKind
private ModifiersPattern
private NamePattern
private static final int
private TypePatternList
private TypePattern
private ThrowsPattern
Inherited from org.aspectj.weaver.patterns.PatternNode:
endsourceContextstart

Constructor Summary

AccessConstructor and Description
public
SignaturePattern(MemberKind kind, ModifiersPattern modifiers, TypePattern returnType, TypePattern declaringType, NamePattern name, TypePatternList parameterTypes, ThrowsPattern throwsPattern, AnnotationTypePattern annotationPattern)

Method Summary

Modifier and TypeMethod and Description
public Object
private void
checkForIncorrectTargetKind(PatternNode patternNode, IScope scope, boolean targetsOtherThanTypeAllowed)

private void
checkForIncorrectTargetKind(PatternNode patternNode, IScope scope, boolean targetsOtherThanTypeAllowed, boolean parameterTargettingAnnotationsAllowed)

public boolean
public boolean
declaringTypeMatchAllowingForCovariance(Member member, UnresolvedType shadowDeclaringType, World world, TypePattern returnTypePattern, ResolvedType sigReturn)

public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
private ResolvedMember
findMethod(ResolvedType aspectType, ResolvedMember ajcMethod)

public AnnotationTypePattern
getAnnotationPattern()

return true if last argument in params is an Object[] but the modifiers say this method was declared with varargs (Object...).

public TypePattern
public List<ExactTypePattern>
public MemberKind
public ModifiersPattern
public NamePattern
public TypePatternList
public TypePattern
public ThrowsPattern
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
private boolean

Returns:

true if a parameter type pattern wants to match on a parameter annotation
isMatchingParameterAnnotations
()

Determine if any pattern in the parameter type pattern list is attempting to match on parameter annotations.

public boolean
private boolean
isParameterAnnotationMatching(TypePattern tp)

Walk the simple structure of a type pattern and determine if any leaf node is involved in parameter annotation matching.

private boolean
public boolean
public boolean
matches(Member joinPointSignature, World world, boolean allowBridgeMethods)

Implements org.aspectj.weaver.patterns.ISignaturePattern.matches.

private FuzzyBoolean
private FuzzyBoolean
matchesExactly(JoinPointSignature aMember, World inAWorld, boolean allowBridgeMethods, boolean subjectMatch)

private FuzzyBoolean
matchesExactlyConstructor(JoinPointSignature aConstructor, World world)

match on declaring type, parameter types, throws types

private FuzzyBoolean
matchesExactlyField(JoinPointSignature aField, World world)

Matches on name, declaring type, field type

private FuzzyBoolean
matchesExactlyMethod(JoinPointSignature aMethod, World world, boolean subjectMatch)

Matches on name, declaring type, return type, parameter types, throws types

private FuzzyBoolean
matchesExactlyStaticInitialization(JoinPointSignature aMember, World world)

Matches on declaring type

private boolean
matchesVarArgs(JoinPointSignature aMethodOrConstructor, World inAWorld)

We've matched against this method or constructor so far, but without considering varargs (which has been matched as a simple array thus far).

public SignaturePattern
parameterizeWith(Map<String, UnresolvedType> typeVariableMap, World w)

Implements org.aspectj.weaver.patterns.ISignaturePattern.parameterizeWith.

return a copy of this signature pattern in which every type variable reference is replaced by the corresponding entry in the map.
private boolean

Returns:

true if it is impossible for the joinpoint to match this signature
parametersCannotMatch
(JoinPointSignature
the joinpoint to quickly match against
methodJoinpoint
)

Quickly detect if the joinpoint absolutely cannot match becaused the method parameters at the joinpoint cannot match against this signature pattern.

public void
postRead(ResolvedType enclosingType)

public static SignaturePattern
private void
reportUnmatchedTargetKindMessage(AnnotationTargetKind[] annotationTargetKinds, PatternNode node, IScope scope, boolean checkMatchesMemberKindName)

public SignaturePattern
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public Object
private boolean
public void
Inherited from org.aspectj.weaver.patterns.PatternNode:
copyLocationFromgetEndgetFileNamegetSourceContextgetSourceLocationgetStartreadLocationsetLocationwriteLocation

Field Detail

annotationPatternback to summary
private AnnotationTypePattern annotationPattern
bitsback to summary
private int bits
CHECKED_FOR_PARAMETER_ANNOTATION_MATCHINGback to summary
private static final int CHECKED_FOR_PARAMETER_ANNOTATION_MATCHING
declaringTypeback to summary
private TypePattern declaringType
hashcodeback to summary
private transient int hashcode
isExactDeclaringTypePatternback to summary
private transient boolean isExactDeclaringTypePattern
kindback to summary
private MemberKind kind
modifiersback to summary
private ModifiersPattern modifiers
nameback to summary
private NamePattern name
PARAMETER_ANNOTATION_MATCHINGback to summary
private static final int PARAMETER_ANNOTATION_MATCHING
parameterTypesback to summary
private TypePatternList parameterTypes
returnTypeback to summary
private TypePattern returnType
throwsPatternback to summary
private ThrowsPattern throwsPattern

Constructor Detail

SignaturePatternback to summary
public SignaturePattern(MemberKind kind, ModifiersPattern modifiers, TypePattern returnType, TypePattern declaringType, NamePattern name, TypePatternList parameterTypes, ThrowsPattern throwsPattern, AnnotationTypePattern annotationPattern)

Method Detail

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

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

Annotations
@Override
checkForIncorrectTargetKindback to summary
private void checkForIncorrectTargetKind(PatternNode patternNode, IScope scope, boolean targetsOtherThanTypeAllowed)
checkForIncorrectTargetKindback to summary
private void checkForIncorrectTargetKind(PatternNode patternNode, IScope scope, boolean targetsOtherThanTypeAllowed, boolean parameterTargettingAnnotationsAllowed)
couldEverMatchback to summary
public boolean couldEverMatch(ResolvedType type)

Implements org.aspectj.weaver.patterns.ISignaturePattern.couldEverMatch.

Annotations
@Override
declaringTypeMatchAllowingForCovarianceback to summary
public boolean declaringTypeMatchAllowingForCovariance(Member member, UnresolvedType shadowDeclaringType, World world, TypePattern returnTypePattern, ResolvedType sigReturn)
equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
findMethodback to summary
private ResolvedMember findMethod(ResolvedType aspectType, ResolvedMember ajcMethod)
getAnnotationPatternback to summary
public AnnotationTypePattern getAnnotationPattern()

return true if last argument in params is an Object[] but the modifiers say this method was declared with varargs (Object...). We shouldn't be matching if this is the case.

getDeclaringTypeback to summary
public TypePattern getDeclaringType()
getExactDeclaringTypesback to summary
public List<ExactTypePattern> getExactDeclaringTypes()

Implements org.aspectj.weaver.patterns.ISignaturePattern.getExactDeclaringTypes.

Annotations
@Override
getKindback to summary
public MemberKind getKind()
getModifiersback to summary
public ModifiersPattern getModifiers()
getNameback to summary
public NamePattern getName()
getParameterTypesback to summary
public TypePatternList getParameterTypes()
getReturnTypeback to summary
public TypePattern getReturnType()
getThrowsPatternback to summary
public ThrowsPattern getThrowsPattern()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isExactDeclaringTypePatternback to summary
public boolean isExactDeclaringTypePattern()
isMatchingParameterAnnotationsback to summary
private boolean isMatchingParameterAnnotations()

Determine if any pattern in the parameter type pattern list is attempting to match on parameter annotations.

Returns:boolean

true if a parameter type pattern wants to match on a parameter annotation

isMatchOnAnyNameback to summary
public boolean isMatchOnAnyName()

Implements org.aspectj.weaver.patterns.ISignaturePattern.isMatchOnAnyName.

Annotations
@Override
isParameterAnnotationMatchingback to summary
private boolean isParameterAnnotationMatching(TypePattern tp)

Walk the simple structure of a type pattern and determine if any leaf node is involved in parameter annotation matching.

isParameterAnnotationMatchingback to summary
private boolean isParameterAnnotationMatching(AnnotationTypePattern tp)
isStarAnnotationback to summary
public boolean isStarAnnotation()

Implements org.aspectj.weaver.patterns.ISignaturePattern.isStarAnnotation.

Annotations
@Override
matchesback to summary
public boolean matches(Member joinPointSignature, World world, boolean allowBridgeMethods)

Implements org.aspectj.weaver.patterns.ISignaturePattern.matches.

Annotations
@Override
matchesAnnotationsback to summary
private FuzzyBoolean matchesAnnotations(ResolvedMember member, World world)
matchesExactlyback to summary
private FuzzyBoolean matchesExactly(JoinPointSignature aMember, World inAWorld, boolean allowBridgeMethods, boolean subjectMatch)
matchesExactlyConstructorback to summary
private FuzzyBoolean matchesExactlyConstructor(JoinPointSignature aConstructor, World world)

match on declaring type, parameter types, throws types

matchesExactlyFieldback to summary
private FuzzyBoolean matchesExactlyField(JoinPointSignature aField, World world)

Matches on name, declaring type, field type

matchesExactlyMethodback to summary
private FuzzyBoolean matchesExactlyMethod(JoinPointSignature aMethod, World world, boolean subjectMatch)

Matches on name, declaring type, return type, parameter types, throws types

matchesExactlyStaticInitializationback to summary
private FuzzyBoolean matchesExactlyStaticInitialization(JoinPointSignature aMember, World world)

Matches on declaring type

matchesVarArgsback to summary
private boolean matchesVarArgs(JoinPointSignature aMethodOrConstructor, World inAWorld)

We've matched against this method or constructor so far, but without considering varargs (which has been matched as a simple array thus far). Now we do the additional checks to see if the parties agree on whether the last parameter is varargs or a straight array.

parameterizeWithback to summary
public SignaturePattern parameterizeWith(Map<String, UnresolvedType> typeVariableMap, World w)

Implements org.aspectj.weaver.patterns.ISignaturePattern.parameterizeWith.

return a copy of this signature pattern in which every type variable reference is replaced by the corresponding entry in the map.

Annotations
@Override
parametersCannotMatchback to summary
private boolean parametersCannotMatch(JoinPointSignature methodJoinpoint)

Quickly detect if the joinpoint absolutely cannot match becaused the method parameters at the joinpoint cannot match against this signature pattern.

Parameters
methodJoinpoint:JoinPointSignature

the joinpoint to quickly match against

Returns:boolean

true if it is impossible for the joinpoint to match this signature

postReadback to summary
public void postRead(ResolvedType enclosingType)
readback to summary
public static SignaturePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException
reportUnmatchedTargetKindMessageback to summary
private void reportUnmatchedTargetKindMessage(AnnotationTargetKind[] annotationTargetKinds, PatternNode node, IScope scope, boolean checkMatchesMemberKindName)
resolveBindingsback to summary
public SignaturePattern resolveBindings(IScope scope, Bindings bindings)

Implements org.aspectj.weaver.patterns.ISignaturePattern.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
traverseback to summary
public Object traverse(PatternNodeVisitor visitor, Object data)

Overrides org.aspectj.weaver.patterns.PatternNode.traverse.

wantToMatchAnnotationPatternback to summary
private boolean wantToMatchAnnotationPattern()
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

private Class SignaturePattern.TypePatternVisitor

extends AbstractPatternNodeVisitor
Class Inheritance

Class which visits the nodes in the TypePattern tree until an ExactTypePattern is found. Once this is found it creates a new ExactAnnotationTypePattern and checks whether the targetKind (created via the @Target annotation) matches ElementType.TYPE if this is the only target kind which is allowed, or matches the signature pattern kind if there is no restriction.

Field Summary

Modifier and TypeField and Description
private Map<ExactAnnotationTypePattern, AnnotationTargetKind[]>
private boolean
private IScope
private boolean

Constructor Summary

AccessConstructor and Description
public
TypePatternVisitor(IScope scope, boolean targetsOtherThanTypeAllowed, boolean parameterTargettingAnnotationsAllowed)

Method Summary

Modifier and TypeMethod and Description
public boolean
public Map<ExactAnnotationTypePattern, AnnotationTargetKind[]>
public Object
public Object
visit(ExactAnnotationTypePattern node, Object data)

Overrides org.aspectj.weaver.patterns.AbstractPatternNodeVisitor.visit.

Implements org.aspectj.weaver.patterns.PatternNodeVisitor.visit.

Do the ExactAnnotationTypePatterns have the incorrect target?
public Object
public Object
public Object
public Object
Inherited from org.aspectj.weaver.patterns.AbstractPatternNodeVisitor:
visitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisit

Field Detail

incorrectTargetKindsback to summary
private Map<ExactAnnotationTypePattern, AnnotationTargetKind[]> incorrectTargetKinds
parameterTargettingAnnotationsAllowedback to summary
private boolean parameterTargettingAnnotationsAllowed
scopeback to summary
private IScope scope
targetsOtherThanTypeAllowedback to summary
private boolean targetsOtherThanTypeAllowed

Constructor Detail

TypePatternVisitorback to summary
public TypePatternVisitor(IScope scope, boolean targetsOtherThanTypeAllowed, boolean parameterTargettingAnnotationsAllowed)

Method Detail

containedIncorrectTargetKindback to summary
public boolean containedIncorrectTargetKind()
getIncorrectTargetKindsback to summary
public Map<ExactAnnotationTypePattern, AnnotationTargetKind[]> getIncorrectTargetKinds()
visitback to summary
public Object visit(WildAnnotationTypePattern node, Object data)

Overrides org.aspectj.weaver.patterns.AbstractPatternNodeVisitor.visit.

Implements org.aspectj.weaver.patterns.PatternNodeVisitor.visit.

Annotations
@Override
visitback to summary
public Object visit(ExactAnnotationTypePattern node, Object data)

Overrides org.aspectj.weaver.patterns.AbstractPatternNodeVisitor.visit.

Implements org.aspectj.weaver.patterns.PatternNodeVisitor.visit.

Do the ExactAnnotationTypePatterns have the incorrect target?

Annotations
@Override
visitback to summary
public Object visit(ExactTypePattern node, Object data)

Overrides org.aspectj.weaver.patterns.AbstractPatternNodeVisitor.visit.

Implements org.aspectj.weaver.patterns.PatternNodeVisitor.visit.

Annotations
@Override
visitback to summary
public Object visit(AndTypePattern node, Object data)

Overrides org.aspectj.weaver.patterns.AbstractPatternNodeVisitor.visit.

Implements org.aspectj.weaver.patterns.PatternNodeVisitor.visit.

Annotations
@Override
visitback to summary
public Object visit(OrTypePattern node, Object data)

Overrides org.aspectj.weaver.patterns.AbstractPatternNodeVisitor.visit.

Implements org.aspectj.weaver.patterns.PatternNodeVisitor.visit.

Annotations
@Override
visitback to summary
public Object visit(AnyWithAnnotationTypePattern node, Object data)

Overrides org.aspectj.weaver.patterns.AbstractPatternNodeVisitor.visit.

Implements org.aspectj.weaver.patterns.PatternNodeVisitor.visit.

Annotations
@Override