Package org.aspectj.weaver.patterns
Class WildTypePattern
java.lang.Object
org.aspectj.weaver.patterns.PatternNode
org.aspectj.weaver.patterns.TypePattern
org.aspectj.weaver.patterns.WildTypePattern
- All Implemented Interfaces:
IHasPosition
,IHasSourceLocation
The PatternParser always creates WildTypePatterns for type patterns in pointcut expressions (apart from *, which is sometimes
directly turned into TypePattern.ANY). resolveBindings() tries to work out what we've really got and turn it into a type pattern
that we can use for matching. This will normally be either an ExactTypePattern or a WildTypePattern.
Here's how the process pans out for various generic and parameterized patterns: (see GenericsWildTypePatternResolvingTestCase)
Foo where Foo exists and is generic Parser creates WildTypePattern namePatterns={Foo} resolveBindings resolves Foo to RT(Foo -
raw) return ExactTypePattern(LFoo;)
Foo<String> where Foo exists and String meets the bounds Parser creates WildTypePattern namePatterns = {Foo},
typeParameters=WTP{String} resolveBindings resolves typeParameters to ExactTypePattern(String) resolves Foo to RT(Foo) returns
ExactTypePattern(PFoo<String>; - parameterized)
Foo<Str*> where Foo exists and takes one bound Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{Str*}
resolveBindings resolves typeParameters to WTP{Str*} resolves Foo to RT(Foo) returns WildTypePattern(name = Foo, typeParameters =
WTP{Str*} isGeneric=false)
Fo*<String> Parser creates WildTypePattern namePatterns = {Fo*}, typeParameters=WTP{String} resolveBindings resolves
typeParameters to ETP{String} returns WildTypePattern(name = Fo*, typeParameters = ETP{String} isGeneric=false)
Foo<?>
Foo<? extends Number>
Foo<? extends Number+>
Foo<? super Number>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.aspectj.weaver.patterns.TypePattern
TypePattern.MatchKind
-
Field Summary
Fields inherited from class org.aspectj.weaver.patterns.TypePattern
AND, annotationPattern, ANY, ANY_KEY, ANY_WITH_ANNO, BINDING, DYNAMIC, ELLIPSIS, ELLIPSIS_KEY, EXACT, HAS_MEMBER, includeSubtypes, isVarArgs, NO, NO_KEY, NOT, OR, STATIC, TYPE_CATEGORY, typeParameters, WILD
Fields inherited from class org.aspectj.weaver.patterns.PatternNode
end, sourceContext, start
-
Constructor Summary
ConstructorDescriptionWildTypePattern
(List<NamePattern> names, boolean includeSubtypes, int dim) WildTypePattern
(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos) WildTypePattern
(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg) WildTypePattern
(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams) WildTypePattern
(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams, TypePattern upperBound, TypePattern[] additionalInterfaceBounds, TypePattern lowerBound) -
Method Summary
Modifier and TypeMethodDescriptionaccept
(PatternNodeVisitor visitor, Object data) protected boolean
boolean
int
Used in conjunction with checks on 'isStar()' to tell you if this pattern represents '*' or '*[]' which are different !boolean
int
hashCode()
boolean
isArray()
boolean
isStar()
protected boolean
matchesArray
(UnresolvedType type) protected boolean
matchesExactly
(ResolvedType type) protected boolean
matchesExactly
(ResolvedType type, ResolvedType annotatedType) boolean
maybeExtractName
(String string) Method maybeExtractName.If this type pattern has no '*' or '..' in itIf this type pattern has no '.' or '*' in it, then return a simple string otherwise, this will return null;parameterizeWith
(Map<String, UnresolvedType> typeVariableMap, World w) return a version of this type pattern in which all type variable references have been replaced by their corresponding entry in the map.static TypePattern
read
(VersionedDataInputStream s, ISourceContext context) static TypePattern
readTypePattern150
(VersionedDataInputStream s, ISourceContext context) static TypePattern
resolveBindings
(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) Need to determine if I'm really a pattern or a reference to a formal We may wish to further optimize the case of pattern vs.void
setIsVarArgs
(boolean isVarArgs) static char[][]
splitNames
(String s, boolean convertDollar) toString()
void
Methods inherited from class org.aspectj.weaver.patterns.TypePattern
getAnnotationPattern, getExactType, getTypeParameters, isBangVoid, isEllipsis, isIncludeSubtypes, isStarAnnotation, isVarArgs, isVoid, matches, matchesStatically, matchesSubtypes, matchesSubtypes, notExactType, postRead, remapAdviceFormals, resolve, resolveExactType, setAnnotationTypePattern, setTypeParameters
Methods inherited from class org.aspectj.weaver.patterns.PatternNode
copyLocationFrom, getEnd, getFileName, getSourceContext, getSourceLocation, getStart, readLocation, setLocation, traverse, writeLocation
-
Field Details
-
boundscheckingoff
public static boolean boundscheckingoff
-
-
Constructor Details
-
WildTypePattern
-
WildTypePattern
-
WildTypePattern
public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg) -
WildTypePattern
public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams, TypePattern upperBound, TypePattern[] additionalInterfaceBounds, TypePattern lowerBound) -
WildTypePattern
public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams)
-
-
Method Details
-
getNamePatterns
-
getUpperBound
-
getLowerBound
-
getAdditionalIntefaceBounds
-
setIsVarArgs
public void setIsVarArgs(boolean isVarArgs) - Overrides:
setIsVarArgs
in classTypePattern
-
couldEverMatchSameTypesAs
- Overrides:
couldEverMatchSameTypesAs
in classTypePattern
-
splitNames
-
matchesExactly
- Specified by:
matchesExactly
in classTypePattern
- See Also:
-
matchesExactly
- Specified by:
matchesExactly
in classTypePattern
-
matchesArray
- Specified by:
matchesArray
in classTypePattern
-
getDimensions
public int getDimensions()Used in conjunction with checks on 'isStar()' to tell you if this pattern represents '*' or '*[]' which are different !- Overrides:
getDimensions
in classTypePattern
-
isArray
public boolean isArray()- Overrides:
isArray
in classTypePattern
-
matchesInstanceof
- Specified by:
matchesInstanceof
in classTypePattern
- See Also:
-
extractName
-
maybeExtractName
Method maybeExtractName.- Parameters:
string
-- Returns:
- boolean
-
maybeGetSimpleName
If this type pattern has no '.' or '*' in it, then return a simple string otherwise, this will return null; -
maybeGetCleanName
If this type pattern has no '*' or '..' in it -
parameterizeWith
Description copied from class:TypePattern
return a version of this type pattern in which all type variable references have been replaced by their corresponding entry in the map.- Specified by:
parameterizeWith
in classTypePattern
-
resolveBindings
public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) Need to determine if I'm really a pattern or a reference to a formal We may wish to further optimize the case of pattern vs. non-pattern We will be replaced by what we return- Overrides:
resolveBindings
in classTypePattern
-
isStar
public boolean isStar()- Overrides:
isStar
in classTypePattern
-
toString
-
equals
-
hashCode
public int hashCode() -
write
- Specified by:
write
in classPatternNode
- Throws:
IOException
-
read
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException - Throws:
IOException
-
readTypePattern150
public static TypePattern readTypePattern150(VersionedDataInputStream s, ISourceContext context) throws IOException - Throws:
IOException
-
readTypePatternOldStyle
public static TypePattern readTypePatternOldStyle(VersionedDataInputStream s, ISourceContext context) throws IOException - Throws:
IOException
-
accept
- Specified by:
accept
in classPatternNode
-
hasFailedResolution
public boolean hasFailedResolution()- Overrides:
hasFailedResolution
in classTypePattern
-