Class DeclareAnnotation

All Implemented Interfaces:
IHasPosition, IHasSourceLocation

public class DeclareAnnotation extends Declare
Represents a declare annotation statement, one of atField, atMethod, atConstructor or atType.
Author:
Andy Clement
  • Field Details

  • Constructor Details

  • Method Details

    • getAnnotationString

      public String getAnnotationString()
      Returns the string, useful before the real annotation has been resolved
    • isExactPattern

      public boolean isExactPattern()
    • getAnnotationMethod

      public String getAnnotationMethod()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • accept

      public Object accept(PatternNodeVisitor visitor, Object data)
      Specified by:
      accept in class PatternNode
    • resolve

      public void resolve(IScope scope)
      Description copied from class: Declare
      Returns this declare mutated
      Specified by:
      resolve in class Declare
    • parameterizeWith

      public Declare parameterizeWith(Map<String,​UnresolvedType> typeVariableBindingMap, World w)
      Description copied from class: Declare
      Returns a version of this declare element in which all references to type variables are replaced with their bindings given in the map.
      Specified by:
      parameterizeWith in class Declare
    • isAdviceLike

      public boolean isAdviceLike()
      Description copied from class: Declare
      Indicates if this declare should be treated like advice. If true, the declare will have no effect in an abstract aspect. It will be inherited by any concrete aspects and will have an effect for each concrete aspect it is ultimately inherited by.
      Specified by:
      isAdviceLike in class Declare
    • setAnnotationString

      public void setAnnotationString(String annotationString)
    • setAnnotationLocation

      public void setAnnotationLocation(int start, int end)
    • getAnnotationSourceStart

      public int getAnnotationSourceStart()
    • getAnnotationSourceEnd

      public int getAnnotationSourceEnd()
    • setAnnotationMethod

      public void setAnnotationMethod(String methodName)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • write

      public void write(CompressingDataOutputStream s) throws IOException
      Specified by:
      write in class PatternNode
      Throws:
      IOException
    • read

      public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException
      Throws:
      IOException
    • matches

      public boolean matches(ResolvedMember resolvedmember, World world)
      For declare atConstructor, atMethod, atField
    • matches

      public boolean matches(ResolvedType type)
      For declare atType.
    • setAspect

      public void setAspect(ResolvedType typeX)
    • getAspect

      public UnresolvedType getAspect()
    • copyAnnotationTo

      public void copyAnnotationTo(ResolvedType onType)
    • getAnnotation

      public AnnotationAJ getAnnotation()
    • getTypePattern

      public TypePattern getTypePattern()
    • getSignaturePattern

      public ISignaturePattern getSignaturePattern()
    • isStarredAnnotationPattern

      public boolean isStarredAnnotationPattern()
    • getKind

      public DeclareAnnotation.Kind getKind()
    • isDeclareAtConstuctor

      public boolean isDeclareAtConstuctor()
    • isDeclareAtMethod

      public boolean isDeclareAtMethod()
    • isDeclareAtType

      public boolean isDeclareAtType()
    • isDeclareAtField

      public boolean isDeclareAtField()
    • getAnnotationType

      public ResolvedType getAnnotationType()
      Returns:
      the type of the annotation
    • isAnnotationAllowedOnField

      public boolean isAnnotationAllowedOnField()
      Returns:
      true if the annotation specified is allowed on a field
    • getPatternAsString

      public String getPatternAsString()
    • couldEverMatch

      public boolean couldEverMatch(ResolvedType type)
      Return true if this declare annotation could ever match something in the specified type - only really able to make intelligent decision if a type was specified in the sig/type pattern signature.
    • getNameSuffix

      public String getNameSuffix()
      Provide a name suffix so that we can tell the different declare annotations forms apart in the AjProblemReporter
      Specified by:
      getNameSuffix in class Declare
    • setRemover

      public void setRemover(boolean b)
    • isRemover

      public boolean isRemover()