public abstract class ClassType_c extends ReferenceType_c implements ClassType
ClassType
represents a class -- either loaded from a
classpath, parsed from a source file, or obtained from other source.ClassType.Kind
Modifier and Type | Field and Description |
---|---|
protected ClassType |
decl |
protected Resolver |
memberCache |
position, ts
Modifier | Constructor and Description |
---|---|
protected |
ClassType_c()
Used for deserializing types.
|
|
ClassType_c(TypeSystem ts) |
|
ClassType_c(TypeSystem ts,
Position pos) |
Modifier and Type | Method and Description |
---|---|
abstract java.util.List<? extends ConstructorInstance> |
constructors()
The class's constructors.
|
ReferenceType |
container()
Get the container class if a member class.
|
ClassType_c |
copy() |
Declaration |
declaration()
Get the original declaration.
|
boolean |
descendsFromImpl(Type ancestor)
Return true if this type descends from
ancestor . |
FieldInstance |
fieldNamed(java.lang.String name)
Get a field by name, or null.
|
abstract java.util.List<? extends FieldInstance> |
fields()
Returns a list of fields declared in this type.
|
abstract Flags |
flags()
Get the class's flags.
|
java.lang.String |
fullName()
Get the full name of the class, if possible.
|
boolean |
hasEnclosingInstance(ClassType encl)
Return true if an object of the class has
an enclosing instance of
encl . |
boolean |
hasEnclosingInstanceImpl(ClassType encl)
Return true if an object of the class has
an enclosing instance of
encl . |
abstract java.util.List<? extends ReferenceType> |
interfaces()
Returns a list of all the type's interfaces.
|
boolean |
isAnonymous()
Return true if the class is an anonymous class.
|
boolean |
isCanonical()
Return true if the type object contains no unknown/ambiguous types.
|
boolean |
isCastValidImpl(Type toType)
Requires: all type arguments are canonical.
|
boolean |
isClass()
Return true if a class type.
|
boolean |
isEnclosed(ClassType maybe_outer)
Return true if the class is strictly contained in
outer . |
boolean |
isEnclosedImpl(ClassType maybe_outer)
Implementation of
isEnclosed . |
boolean |
isImplicitCastValidImpl(Type toType)
Return true if a value of this type can be assigned to a variable of
type
toType . |
boolean |
isInner()
Deprecated.
Was incorrectly defined. Use isNested for nested classes,
and isInnerClass for inner classes.
|
boolean |
isInnerClass()
Return true if the class is an inner class, that is, it is a nested
class that is not explicitly or implicitly declared static; an interface
is never an inner class.
|
boolean |
isLocal()
Return true if the class is a local class.
|
boolean |
isMember()
Return true if the class is a member class.
|
boolean |
isNested()
Return true if the class is a nested.
|
boolean |
isThrowable()
Return true if a subclass of
Throwable . |
boolean |
isTopLevel()
Return true if the class is top-level (i.e., not inner).
|
boolean |
isUncheckedException()
Return true if an unchecked exception.
|
abstract Job |
job() |
abstract ClassType.Kind |
kind()
Get the class's kind: top-level, member, local, or anonymous.
|
abstract java.util.List<? extends ClassType> |
memberClasses()
The class's member classes.
|
ClassType |
memberClassNamed(java.lang.String name)
Returns the member class with the given name, or null.
|
java.util.List<? extends MemberInstance> |
members()
Return a list of all the type's members.
|
abstract java.util.List<? extends MethodInstance> |
methods()
Returns a list of methods declared in this type.
|
abstract java.lang.String |
name()
Get the short name of the class, if possible.
|
abstract ClassType |
outer()
The class's outer class, or null if a top-level class.
|
abstract Package |
package_()
Get the class's package.
|
void |
print(CodeWriter w)
Pretty-print the name of this class to w.
|
Resolver |
resolver()
A resolver to access member classes of the class.
|
void |
setDeclaration(Declaration decl)
Set the original declaration.
|
abstract Type |
superType()
Returns the supertype of this type.
|
ClassType |
toClass()
Cast the type to a class type, or null.
|
java.lang.String |
toString()
Yields a string representing this type.
|
java.lang.String |
translate(Resolver c)
Return a string into which to translate the type.
|
hasMethod, hasMethodImpl, isReference, methods, methodsNamed, toReference
arrayOf, arrayOf, descendsFrom, isArray, isBoolean, isByte, isCastValid, isChar, isComparable, isDouble, isFloat, isImplicitCastValid, isInt, isIntOrLess, isLong, isLongOrLess, isNull, isNumeric, isPackage, isPrimitive, isShort, isSubtype, isSubtypeImpl, isType, isVoid, numericConversionValid, numericConversionValid, numericConversionValidImpl, numericConversionValidImpl, toArray, toNull, toPackage, toPrimitive, toType, typeEquals, typeEqualsImpl
equals, equalsImpl, hashCode, position, typeSystem
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
inStaticContext
hasMethod, hasMethodImpl, methods, methodsNamed
arrayOf, arrayOf, descendsFrom, isArray, isBoolean, isByte, isCastValid, isChar, isComparable, isDouble, isFloat, isImplicitCastValid, isInt, isIntOrLess, isLong, isLongOrLess, isNull, isNumeric, isPrimitive, isReference, isShort, isSubtype, isSubtypeImpl, isVoid, numericConversionValid, numericConversionValid, numericConversionValidImpl, numericConversionValidImpl, toArray, toNull, toPrimitive, toReference, typeEquals, typeEqualsImpl
equalsImpl, position, typeSystem
setContainer, setFlags
protected ClassType_c()
public ClassType_c(TypeSystem ts)
public ClassType_c(TypeSystem ts, Position pos)
public Resolver resolver()
ClassType
public ClassType_c copy()
copy
in interface Copy<TypeObject>
copy
in class TypeObject_c
public Declaration declaration()
Declaration
declaration
in interface Declaration
public void setDeclaration(Declaration decl)
Declaration
setDeclaration
in interface Declaration
public abstract Job job()
public abstract ClassType.Kind kind()
ClassType
public abstract ClassType outer()
ClassType
public abstract java.lang.String name()
public ReferenceType container()
container
in interface MemberInstance
public java.lang.String fullName()
public boolean isTopLevel()
ClassType
isTopLevel
in interface ClassType
public boolean isMember()
ClassType
public boolean isLocal()
ClassType
public boolean isAnonymous()
ClassType
isAnonymous
in interface ClassType
@Deprecated public final boolean isInner()
ClassType
public boolean isNested()
ClassType
public boolean isInnerClass()
ClassType
isInnerClass
in interface ClassType
public boolean isCanonical()
TypeObject
isCanonical
in interface TypeObject
isCanonical
in class Type_c
public boolean isClass()
Type
public ClassType toClass()
Type
public abstract Package package_()
package_
in interface Importable
public abstract Flags flags()
flags
in interface MemberInstance
public abstract java.util.List<? extends ConstructorInstance> constructors()
ClassType
ConstructorInstance
.constructors
in interface ClassType
ConstructorInstance
public abstract java.util.List<? extends ClassType> memberClasses()
ClassType
ClassType
.memberClasses
in interface ClassType
ClassType
public abstract java.util.List<? extends MethodInstance> methods()
ReferenceType
methods
in interface ReferenceType
methods
in class ReferenceType_c
MethodInstance
.MethodInstance
public abstract java.util.List<? extends FieldInstance> fields()
ReferenceType
fields
in interface ReferenceType
fields
in class ReferenceType_c
FieldInstance
.FieldInstance
public abstract java.util.List<? extends ReferenceType> interfaces()
ReferenceType
interfaces
in interface ReferenceType
interfaces
in class ReferenceType_c
Type
.Type
public abstract Type superType()
ReferenceType
superType
in interface ReferenceType
superType
in class ReferenceType_c
public java.util.List<? extends MemberInstance> members()
ReferenceType
members
in interface ReferenceType
members
in class ReferenceType_c
MemberInstance
.MemberInstance
public FieldInstance fieldNamed(java.lang.String name)
ClassType
fieldNamed
in interface ClassType
fieldNamed
in interface ReferenceType
public ClassType memberClassNamed(java.lang.String name)
ClassType
memberClassNamed
in interface ClassType
public boolean descendsFromImpl(Type ancestor)
Type
ancestor
.descendsFromImpl
in interface Type
descendsFromImpl
in class ReferenceType_c
public boolean isThrowable()
Type
Throwable
.isThrowable
in interface Type
isThrowable
in class Type_c
public boolean isUncheckedException()
Type
isUncheckedException
in interface Type
isUncheckedException
in class Type_c
public boolean isImplicitCastValidImpl(Type toType)
Type
toType
.isImplicitCastValidImpl
in interface Type
isImplicitCastValidImpl
in class ReferenceType_c
public boolean isCastValidImpl(Type toType)
ReferenceType_c
isCastValidImpl
in interface Type
isCastValidImpl
in class ReferenceType_c
public final boolean isEnclosed(ClassType maybe_outer)
ClassType
outer
.isEnclosed
in interface ClassType
public final boolean hasEnclosingInstance(ClassType encl)
ClassType
encl
.hasEnclosingInstance
in interface ClassType
public java.lang.String translate(Resolver c)
Type
public java.lang.String toString()
Type
public void print(CodeWriter w)
public boolean isEnclosedImpl(ClassType maybe_outer)
ClassType
isEnclosed
.
This method should only be called by the TypeSystem
or by a subclass.isEnclosedImpl
in interface ClassType
public boolean hasEnclosingInstanceImpl(ClassType encl)
encl
.hasEnclosingInstanceImpl
in interface ClassType