Class TypePattern

java.lang.Object
org.aspectj.weaver.patterns.PatternNode
org.aspectj.weaver.patterns.TypePattern
All Implemented Interfaces:
IHasPosition, IHasSourceLocation
Direct Known Subclasses:
AndTypePattern, AnyTypePattern, AnyWithAnnotationTypePattern, EllipsisTypePattern, ExactTypePattern, HasMemberTypePattern, NotTypePattern, NoTypePattern, OrTypePattern, TypeCategoryTypePattern, WildTypePattern

public abstract class TypePattern extends PatternNode
On creation, type pattern only contains WildTypePattern nodes, not BindingType or ExactType.

Then we call resolveBindings() during compilation During concretization of enclosing pointcuts, we call remapAdviceFormals

Author:
Erik Hilsdale, Jim Hugunin
  • Field Details

  • Constructor Details

    • TypePattern

      protected TypePattern(boolean includeSubtypes, boolean isVarArgs, TypePatternList typeParams)
    • TypePattern

      protected TypePattern(boolean includeSubtypes, boolean isVarArgs)
    • TypePattern

      protected TypePattern(boolean includeSubtypes)
  • Method Details

    • getAnnotationPattern

      public AnnotationTypePattern getAnnotationPattern()
    • isVarArgs

      public boolean isVarArgs()
    • isStarAnnotation

      public boolean isStarAnnotation()
    • isArray

      public boolean isArray()
    • setAnnotationTypePattern

      public void setAnnotationTypePattern(AnnotationTypePattern annPatt)
    • setTypeParameters

      public void setTypeParameters(TypePatternList typeParams)
    • getTypeParameters

      public TypePatternList getTypeParameters()
    • setIsVarArgs

      public void setIsVarArgs(boolean isVarArgs)
    • couldEverMatchSameTypesAs

      protected boolean couldEverMatchSameTypesAs(TypePattern other)
    • matchesStatically

      public boolean matchesStatically(ResolvedType type)
    • matchesInstanceof

      public abstract FuzzyBoolean matchesInstanceof(ResolvedType type)
    • matches

      public final FuzzyBoolean matches(ResolvedType type, TypePattern.MatchKind kind)
    • matchesExactly

      protected abstract boolean matchesExactly(ResolvedType type)
    • matchesExactly

      protected abstract boolean matchesExactly(ResolvedType type, ResolvedType annotatedType)
    • matchesSubtypes

      protected boolean matchesSubtypes(ResolvedType type)
    • matchesSubtypes

      protected boolean matchesSubtypes(ResolvedType superType, ResolvedType annotatedType)
    • resolveExactType

      public UnresolvedType resolveExactType(IScope scope, Bindings bindings)
    • getExactType

      public UnresolvedType getExactType()
    • notExactType

      protected TypePattern notExactType(IScope s)
    • resolveBindings

      public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType)
      This can modify in place, or return a new TypePattern if the type changes.
    • resolve

      public void resolve(World world)
    • parameterizeWith

      public abstract TypePattern 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.
    • postRead

      public void postRead(ResolvedType enclosingType)
    • isEllipsis

      public boolean isEllipsis()
    • isStar

      public boolean isStar()
    • remapAdviceFormals

      public TypePattern remapAdviceFormals(IntMap bindings)
      This is called during concretization of pointcuts, it is used by BindingTypePattern to return a new BindingTypePattern with a formal index appropiate for the advice, rather than for the lexical declaration, i.e. this handles transforamtions through named pointcuts.
       pointcut foo(String name): args(name);
       --> This makes a BindingTypePattern(0) pointing to the 0th formal
      
       before(Foo f, String n): this(f) && foo(n) { ... }
       --> when resolveReferences is called on the args from the above, it
           will return a BindingTypePattern(1)
      
       before(Foo f): this(f) && foo(*) { ... }
       --> when resolveReferences is called on the args from the above, it
           will return an ExactTypePattern(String)
       
    • read

      public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException
      Throws:
      IOException
    • isIncludeSubtypes

      public boolean isIncludeSubtypes()
    • isBangVoid

      public boolean isBangVoid()
      For quickly recognizing the pattern '!void'
    • isVoid

      public boolean isVoid()
      for quickly recognizing the pattern 'void'
    • hasFailedResolution

      public boolean hasFailedResolution()