Class DeclaredType
java.lang.Object
org.checkerframework.afu.scenelib.type.Type
org.checkerframework.afu.scenelib.type.DeclaredType
A Java type with optional type parameters and inner type. For example:
type type<type parameters>.inner typeA
DeclaredType can represent a wildcard by using "?" as the name. If this type is
a wildcard, it is illegal to call addTypeParameter(Type), getTypeParameter(int), getTypeParameters(), setInnerType(DeclaredType),
getInnerType(), and setTypeParameters(List). If called, an IllegalStateException will be thrown.
Types are stored with the outer most type at the top of the type tree. This is opposite to the way types are stored in javac.
-
Nested Class Summary
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new declared type with an empty name and no type parameters or inner type.DeclaredType(String name) Creates a new declared type with no type parameters or inner type. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTypeParameter(Type typeParameter) Adds the given type parameter to this type.Gets the inner type.getKind()getName()Gets the raw, un-annotated name of this type.getTypeParameter(int index) Gets the type parameter at the given index.Gets a copy of the type parameters of this type.booleanDetermines if this type is a wildcard.voidsetInnerType(DeclaredType innerType) Sets the inner type.voidSets the raw, un-annotated name of this type.voidsetTypeParameters(List<Type> typeParameters) Sets the type parameters of this type.toString()Methods inherited from class org.checkerframework.afu.scenelib.type.Type
addAnnotation, clearAnnotations, getAnnotation, getAnnotations, setAnnotations
-
Field Details
-
WILDCARD
Thenameof a wildcard type.- See Also:
-
-
Constructor Details
-
DeclaredType
Creates a new declared type with no type parameters or inner type.- Parameters:
name- the raw, un-annotated name of this type, or "?" for a wildcard
-
DeclaredType
public DeclaredType()Creates a new declared type with an empty name and no type parameters or inner type.
-
-
Method Details
-
setName
Sets the raw, un-annotated name of this type.- Parameters:
name- the name
-
getName
Gets the raw, un-annotated name of this type.- Returns:
- the name
-
addTypeParameter
Adds the given type parameter to this type.- Parameters:
typeParameter- the type parameter
-
setTypeParameters
Sets the type parameters of this type.- Parameters:
typeParameters- the type parameters
-
getTypeParameter
Gets the type parameter at the given index.- Parameters:
index- the index- Returns:
- the type parameter
-
getTypeParameters
Gets a copy of the type parameters of this type. This will be empty if there are none.- Returns:
- the type parameters
-
setInnerType
Sets the inner type.- Parameters:
innerType- the inner type
-
getInnerType
Gets the inner type. This will benullif there is none.- Returns:
- the inner type or
null
-
getKind
Description copied from class:Type -
isWildcard
public boolean isWildcard()Determines if this type is a wildcard.- Returns:
trueif this type is a wildcard,falseotherwise
-
toString
-