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 AMethod
s. 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 ATypeElement
The type of a field or a method parameter. -
Method Summary
Modifier and TypeMethodDescription<R,
T> R accept
(ElementVisitor<R, T> v, T t) clone()
boolean
Returns true if thisAElement
equalso
(see warnings below).boolean
Returns true if thisAElement
equalso
.int
hashCode()
boolean
isEmpty()
Returns true if thisAElement
is empty.Returns the top-level annotation on this that has the given name.void
prune()
Removes empty subelements of thisAElement
depth-first.void
toString()
-
Field Details
-
tlAnnotationsHere
The top-level annotations directly on this element. Annotations on subelements are in those subelements'tlAnnotationsHere
sets, 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
type
field represents its type, whose annotations are type annotations.When this AElement object is NOT a field or method parameter, the
type
field 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 thisAElement
equalso
(see warnings below). Generally speaking, twoAElement
s 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
AElement
s are equal even if order of subelements differs. - Two
AElement
s 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()
bothAElement
s first.
- While subelement collections usually remember the order in which subelements were added
and regurgitate them in this order, two
-
equals
Returns true if thisAElement
equalso
. 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 thisAElement
is empty.- Returns:
- true iff this is empty
-
prune
public void prune()Removes empty subelements of thisAElement
depth-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
-