org.aspectj.weaver.patterns
Class WildTypePattern

java.lang.Object
  extended by org.aspectj.weaver.patterns.PatternNode
      extended by org.aspectj.weaver.patterns.TypePattern
          extended by org.aspectj.weaver.patterns.WildTypePattern
All Implemented Interfaces:
IHasPosition, IHasSourceLocation

public class WildTypePattern
extends TypePattern

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 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; - parameterized) Foo 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* 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 Foo Foo


Nested Class Summary
 
Nested classes/interfaces inherited from class org.aspectj.weaver.patterns.TypePattern
TypePattern.MatchKind
 
Field Summary
static boolean boundscheckingoff
           
 
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
WildTypePattern(java.util.List<NamePattern> names, boolean includeSubtypes, int dim)
           
WildTypePattern(java.util.List<NamePattern> names, boolean includeSubtypes, int dim, int endPos)
           
WildTypePattern(java.util.List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg)
           
WildTypePattern(java.util.List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams)
           
WildTypePattern(java.util.List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams, TypePattern upperBound, TypePattern[] additionalInterfaceBounds, TypePattern lowerBound)
           
 
Method Summary
 java.lang.Object accept(PatternNodeVisitor visitor, java.lang.Object data)
           
protected  boolean couldEverMatchSameTypesAs(TypePattern other)
           
 boolean equals(java.lang.Object other)
           
 NamePattern extractName()
           
 TypePattern[] getAdditionalIntefaceBounds()
           
 int getDimensions()
          Used in conjunction with checks on 'isStar()' to tell you if this pattern represents '*' or '*[]' which are different !
 TypePattern getLowerBound()
           
 NamePattern[] getNamePatterns()
           
 TypePattern getUpperBound()
           
 boolean hasFailedResolution()
           
 int hashCode()
           
 boolean isArray()
           
 boolean isStar()
           
protected  boolean matchesExactly(ResolvedType type)
           
protected  boolean matchesExactly(ResolvedType type, ResolvedType annotatedType)
           
 FuzzyBoolean matchesInstanceof(ResolvedType type)
           
 boolean maybeExtractName(java.lang.String string)
          Method maybeExtractName.
 java.lang.String maybeGetCleanName()
          If this type pattern has no '*' or '..' in it
 java.lang.String maybeGetSimpleName()
          If this type pattern has no '.' or '*' in it, then return a simple string otherwise, this will return null;
 TypePattern parameterizeWith(java.util.Map<java.lang.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 readTypePatternOldStyle(VersionedDataInputStream s, ISourceContext context)
           
 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(java.lang.String s, boolean convertDollar)
           
 java.lang.String toString()
           
 void write(CompressingDataOutputStream s)
           
 
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

boundscheckingoff

public static boolean boundscheckingoff
Constructor Detail

WildTypePattern

public WildTypePattern(java.util.List<NamePattern> names,
                       boolean includeSubtypes,
                       int dim)

WildTypePattern

public WildTypePattern(java.util.List<NamePattern> names,
                       boolean includeSubtypes,
                       int dim,
                       int endPos)

WildTypePattern

public WildTypePattern(java.util.List<NamePattern> names,
                       boolean includeSubtypes,
                       int dim,
                       int endPos,
                       boolean isVarArg)

WildTypePattern

public WildTypePattern(java.util.List<NamePattern> names,
                       boolean includeSubtypes,
                       int dim,
                       int endPos,
                       boolean isVarArg,
                       TypePatternList typeParams,
                       TypePattern upperBound,
                       TypePattern[] additionalInterfaceBounds,
                       TypePattern lowerBound)

WildTypePattern

public WildTypePattern(java.util.List<NamePattern> names,
                       boolean includeSubtypes,
                       int dim,
                       int endPos,
                       boolean isVarArg,
                       TypePatternList typeParams)
Method Detail

getNamePatterns

public NamePattern[] getNamePatterns()

getUpperBound

public TypePattern getUpperBound()

getLowerBound

public TypePattern getLowerBound()

getAdditionalIntefaceBounds

public TypePattern[] getAdditionalIntefaceBounds()

setIsVarArgs

public void setIsVarArgs(boolean isVarArgs)
Overrides:
setIsVarArgs in class TypePattern

couldEverMatchSameTypesAs

protected boolean couldEverMatchSameTypesAs(TypePattern other)
Overrides:
couldEverMatchSameTypesAs in class TypePattern

splitNames

public static char[][] splitNames(java.lang.String s,
                                  boolean convertDollar)

matchesExactly

protected boolean matchesExactly(ResolvedType type)
Specified by:
matchesExactly in class TypePattern
See Also:
org.aspectj.weaver.TypePattern#matchesExactly(IType)

matchesExactly

protected boolean matchesExactly(ResolvedType type,
                                 ResolvedType annotatedType)
Specified by:
matchesExactly in class TypePattern

getDimensions

public int getDimensions()
Used in conjunction with checks on 'isStar()' to tell you if this pattern represents '*' or '*[]' which are different !


isArray

public boolean isArray()
Overrides:
isArray in class TypePattern

matchesInstanceof

public FuzzyBoolean matchesInstanceof(ResolvedType type)
Specified by:
matchesInstanceof in class TypePattern
See Also:
org.aspectj.weaver.TypePattern#matchesInstanceof(IType)

extractName

public NamePattern extractName()

maybeExtractName

public boolean maybeExtractName(java.lang.String string)
Method maybeExtractName.

Parameters:
string -
Returns:
boolean

maybeGetSimpleName

public java.lang.String maybeGetSimpleName()
If this type pattern has no '.' or '*' in it, then return a simple string otherwise, this will return null;


maybeGetCleanName

public java.lang.String maybeGetCleanName()
If this type pattern has no '*' or '..' in it


parameterizeWith

public TypePattern parameterizeWith(java.util.Map<java.lang.String,UnresolvedType> typeVariableMap,
                                    World w)
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 class TypePattern

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 class TypePattern

isStar

public boolean isStar()
Overrides:
isStar in class TypePattern

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

write

public void write(CompressingDataOutputStream s)
           throws java.io.IOException
Specified by:
write in class PatternNode
Throws:
java.io.IOException

read

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

readTypePattern150

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

readTypePatternOldStyle

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

accept

public java.lang.Object accept(PatternNodeVisitor visitor,
                               java.lang.Object data)
Specified by:
accept in class PatternNode

hasFailedResolution

public boolean hasFailedResolution()
Overrides:
hasFailedResolution in class TypePattern