Class AClass
java.lang.Object
org.checkerframework.afu.scenelib.el.AElement
org.checkerframework.afu.scenelib.el.ADeclaration
org.checkerframework.afu.scenelib.el.AClass
- All Implemented Interfaces:
Cloneable
An annotated class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe class's annotated type parameter bounds.final String
The fully-qualified name of the annotated class.final VivifyingMap
<String, AExpression> final VivifyingMap
<String, AField> The class's annotated fields; map key is field name.final VivifyingMap
<Integer, ABlock> final VivifyingMap
<String, AMethod> The class's annotated methods; a method's key consists of its name followed by its erased signature in JVML format.final VivifyingMap
<Integer, ABlock> Fields inherited from class org.checkerframework.afu.scenelib.el.ADeclaration
insertAnnotations, insertTypecasts
Fields inherited from class org.checkerframework.afu.scenelib.el.AElement
description, tlAnnotationsHere, type
-
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).Collection
<? extends Annotation> Returns the annotations on the class.Returns the set of enum constants for this class, or null if this is not an enum.Returns all the fields that have been vivified on a class.Returns all the methods that have been vivified on a class.Returns the type of the class, or null if it is unknown.int
hashCode()
boolean
Returns true if this class is an annotation.boolean
isAnnotation
(String className) Returns true if the given class is an annotation.boolean
isEmpty()
Returns true if thisAElement
is empty.boolean
isEnum()
Returns true if this class is an enum.boolean
Returns true if the given class is an enum.boolean
Returns true if this class is an interface.boolean
isInterface
(String className) Returns true if the given class is an interface.boolean
isRecord()
Returns true if this class is an record.boolean
Returns true if the given class is an record.void
markAsAnnotation
(String className) Marks the given simple name as an annotation.void
markAsEnum
(String className) Marks the given simple class name as an enum.void
markAsInterface
(String className) Marks the given simple name as an interface.void
markAsRecord
(String className) Marks the given simple name as a record.void
prune()
Removes empty subelements of thisAElement
depth-first.void
setEnumConstants
(List<VariableElement> enumConstants) Marks this class as an enum.void
setTypeElement
(TypeElement typeElement) Set the type element representing the class.toString()
unparse()
Methods inherited from class org.checkerframework.afu.scenelib.el.AElement
equals, lookup, tlAnnotationsHereFormatted
-
Field Details
-
bounds
The class's annotated type parameter bounds. -
extendsImplements
-
methods
The class's annotated methods; a method's key consists of its name followed by its erased signature in JVML format. For example,foo()V
orbar(B[I[[Ljava/lang/String;)I
. The annotation scene library does not validate the keys, nor does it check that annotated subelements of theAMethod
s exist in the signature. -
staticInits
-
instanceInits
-
fields
The class's annotated fields; map key is field name. -
fieldInits
-
className
The fully-qualified name of the annotated class.
-
-
Method Details
-
clone
-
equals
Description copied from class:AElement
Returns true if thisAElement
equalso
(see warnings below). Generally speaking, twoAElement
s are equal if they are of the same type, have the sameAElement.tlAnnotationsHere
, 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 shouldAElement.prune()
bothAElement
s first.
- Overrides:
equals
in classADeclaration
- While subelement collections usually remember the order in which subelements were added
and regurgitate them in this order, two
-
hashCode
public int hashCode()- Overrides:
hashCode
in classADeclaration
-
isEmpty
public boolean isEmpty()Description copied from class:AElement
Returns true if thisAElement
is empty.- Overrides:
isEmpty
in classADeclaration
- Returns:
- true iff this is empty
-
prune
public void prune()Description copied from class:AElement
Removes empty subelements of thisAElement
depth-first.- Overrides:
prune
in classADeclaration
-
toString
- Overrides:
toString
in classADeclaration
-
unparse
-
unparse
-
accept
- Specified by:
accept
in classADeclaration
-
isEnum
Returns true if the given class is an enum.- Parameters:
className
- the simple class name of this class or one of its outer classes- Returns:
- true if the given class is an enum
-
isEnum
public boolean isEnum()Returns true if this class is an enum.- Returns:
- true if this class is an enum
-
markAsEnum
Marks the given simple class name as an enum. This method is used to mark outer classes of this class that have not been vivified, meaning that only their names are available.Note that this code will misbehave if a class has the same name as its inner enum, or vice-versa, because this uses simple names.
- Parameters:
className
- the simple class name of this class or one of its outer classes
-
getEnumConstants
Returns the set of enum constants for this class, or null if this is not an enum.- Returns:
- the enum constants, or null if this is not an enum
-
setEnumConstants
Marks this class as an enum.- Parameters:
enumConstants
- the list of enum constants for the class
-
isAnnotation
Returns true if the given class is an annotation.- Parameters:
className
- the simple class name of this class or one of its outer classes- Returns:
- true if the given class is an annotation
-
isAnnotation
public boolean isAnnotation()Returns true if this class is an annotation.- Returns:
- true if this class is an annotation
-
markAsAnnotation
Marks the given simple name as an annotation.- Parameters:
className
- the simple class name of this class or one of its outer classes- See Also:
-
isInterface
Returns true if the given class is an interface.- Parameters:
className
- the simple class name of this class or one of its outer classes- Returns:
- true if the given class is an interface
-
isInterface
public boolean isInterface()Returns true if this class is an interface.- Returns:
- true if this class is an interface
-
markAsInterface
Marks the given simple name as an interface.- Parameters:
className
- the simple class name of this class or one of its outer classes- See Also:
-
isRecord
Returns true if the given class is an record.- Parameters:
className
- the simple class name of this class or one of its outer classes- Returns:
- true if the given class is an record
-
isRecord
public boolean isRecord()Returns true if this class is an record.- Returns:
- true if this class is an record
-
markAsRecord
Marks the given simple name as a record.- Parameters:
className
- the simple class name of this class or one of its outer classes- See Also:
-
getTypeElement
Returns the type of the class, or null if it is unknown. Callers should ensure that either:setTypeElement(TypeElement)
has been called, or- the return value is checked against null.
- Returns:
- a type element representing this class
-
setTypeElement
Set the type element representing the class.- Parameters:
typeElement
- the type element representing the class
-
getMethods
Returns all the methods that have been vivified on a class.- Returns:
- a map from method signature (in JVM format) to the object representing the method
-
getFields
Returns all the fields that have been vivified on a class.- Returns:
- a map from field name to the object representing the field
-
getAnnotations
Returns the annotations on the class.- Returns:
- the annotations, directly from scenelib
-