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 StringThe 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, insertTypecastsFields 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()booleanReturns true if thisAElementequalso(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.inthashCode()booleanReturns true if this class is an annotation.booleanisAnnotation(String className) Returns true if the given class is an annotation.booleanisEmpty()Returns true if thisAElementis empty.booleanisEnum()Returns true if this class is an enum.booleanReturns true if the given class is an enum.booleanReturns true if this class is an interface.booleanisInterface(String className) Returns true if the given class is an interface.booleanisRecord()Returns true if this class is an record.booleanReturns true if the given class is an record.voidmarkAsAnnotation(String className) Marks the given simple name as an annotation.voidmarkAsEnum(String className) Marks the given simple class name as an enum.voidmarkAsInterface(String className) Marks the given simple name as an interface.voidmarkAsRecord(String className) Marks the given simple name as a record.voidprune()Removes empty subelements of thisAElementdepth-first.voidsetEnumConstants(List<VariableElement> enumConstants) Marks this class as an enum.voidsetTypeElement(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()Vorbar(B[I[[Ljava/lang/String;)I. The annotation scene library does not validate the keys, nor does it check that annotated subelements of theAMethods 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:AElementReturns true if thisAElementequalso(see warnings below). Generally speaking, twoAElements 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
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 shouldAElement.prune()bothAElements first.
- Overrides:
equalsin 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:
hashCodein classADeclaration
-
isEmpty
public boolean isEmpty()Description copied from class:AElementReturns true if thisAElementis empty.- Overrides:
isEmptyin classADeclaration- Returns:
- true iff this is empty
-
prune
public void prune()Description copied from class:AElementRemoves empty subelements of thisAElementdepth-first.- Overrides:
prunein classADeclaration
-
toString
- Overrides:
toStringin classADeclaration
-
unparse
-
unparse
-
accept
- Specified by:
acceptin 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
-