Class AElement
java.lang.Object
org.checkerframework.afu.scenelib.el.AElement
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
ADeclaration,AExpression,AnnotationDef,ATypeElement
An
AElement represents a Java element and the annotations it carries. Some
AElements may contain others; for example, an AClass may contain AMethods. Every
AElement usually belongs directly or indirectly to an AScene. Each subclass of
AElement represents one kind of annotatable element; its name should make this clear.
The name AElement stands for "annotatable element" or "annotated element".
-
Field Summary
FieldsModifier and TypeFieldDescriptionA description of the element.final Set<Annotation> The top-level annotations directly on this element.final ATypeElementThe type of a field or a method parameter. -
Method Summary
Modifier and TypeMethodDescription<R,T> R accept(ElementVisitor<R, T> v, T t) clone()booleanReturns true if thisAElementequalso(see warnings below).booleanReturns true if thisAElementequalso.inthashCode()booleanisEmpty()Returns true if thisAElementis empty.Returns the top-level annotation on this that has the given name.voidprune()Removes empty subelements of thisAElementdepth-first.voidtoString()
-
Field Details
-
tlAnnotationsHere
The top-level annotations directly on this element. Annotations on subelements are in those subelements'tlAnnotationsHeresets, not here. -
type
The type of a field or a method parameter.When this AElement object is a field or method parameter, its annotations are declaration annotations, and the
typefield represents its type, whose annotations are type annotations.When this AElement object is NOT a field or method parameter, the
typefield is null. -
description
A description of the element. Used for debugging and diagnostic messages. Almost always a String, but in ATypeElement it is an ASTPath.
-
-
Method Details
-
clone
-
equals
Returns true if thisAElementequalso(see warnings below). Generally speaking, twoAElements are equal if they are of the same type, have the sametlAnnotationsHere, and have recursively equal, corresponding subelements. Two warnings:- While subelement collections usually remember the order in which subelements were added
and regurgitate them in this order, two
AElements are equal even if order of subelements differs. - Two
AElements are unequal if one has a subelement that the other does not, even if the tree of elements rooted at the subelement contains no annotations. Thus, if you want to compare the annotations, you shouldprune()bothAElements first.
- While subelement collections usually remember the order in which subelements were added
and regurgitate them in this order, two
-
equals
Returns true if thisAElementequalso. This is a slightly faster variant ofequals(Object)for when the argument is statically known to be another nonnullAElement.- Parameters:
o- the AElement to compare to- Returns:
- true if this is equal to
o
-
hashCode
public int hashCode() -
isEmpty
public boolean isEmpty()Returns true if thisAElementis empty.- Returns:
- true iff this is empty
-
prune
public void prune()Removes empty subelements of thisAElementdepth-first. -
toString
-
lookup
Returns the top-level annotation on this that has the given name. Return null if no such annotation exists.- Parameters:
name- the fully-qualified type name of the annotation to search for- Returns:
- the annotation on this with the given name, or null if none exists
-
tlAnnotationsHereFormatted
-
accept
-