public class ArrayType_c extends ReferenceType_c implements ArrayType
ArrayType
represents an array of base java types.Modifier and Type | Field and Description |
---|---|
protected Type |
base |
protected java.util.List<FieldInstance> |
fields |
protected java.util.List<ClassType> |
interfaces |
protected java.util.List<MethodInstance> |
methods |
position, ts
Modifier | Constructor and Description |
---|---|
protected |
ArrayType_c()
Used for deserializing types.
|
|
ArrayType_c(TypeSystem ts,
Position pos,
Type base) |
Modifier and Type | Method and Description |
---|---|
Type |
base()
Base type of the array.
|
ArrayType |
base(Type base)
Set the base type of the array, returning a new type.
|
MethodInstance |
cloneMethod()
The array's clone() method.
|
protected MethodInstance |
createCloneMethodInstance() |
protected FieldInstance |
createLengthFieldInstance() |
int |
dims()
Return the number of dimensions in this array type.
|
boolean |
equalsImpl(TypeObject t)
Default implementation is pointer equality.
|
FieldInstance |
fieldNamed(java.lang.String name)
Return the field named
name , or null. |
java.util.List<? extends FieldInstance> |
fields()
Returns a list of fields declared in this type.
|
int |
hashCode() |
protected void |
init() |
java.util.List<? extends ReferenceType> |
interfaces()
Returns a list of all the type's interfaces.
|
boolean |
isArray()
Return true if an array type.
|
boolean |
isCanonical()
Return true if the type object contains no unknown/ambiguous types.
|
boolean |
isCastValidImpl(Type toType)
Requires: all type arguments are canonical.
|
boolean |
isImplicitCastValidImpl(Type toType)
Return true if a value of this type can be assigned to a variable of
type
toType . |
FieldInstance |
lengthField()
The array's length field.
|
java.util.List<? extends MethodInstance> |
methods()
Returns a list of methods declared in this type.
|
void |
print(CodeWriter w)
Output a compilable representation of this type to
w . |
Type |
superType()
Returns the supertype of this type.
|
ArrayType |
toArray()
Cast the type to an array 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.
|
boolean |
typeEqualsImpl(Type t)
Return true if this type is equivalent to t.
|
Type |
ultimateBase()
The ultimate base of the array.
|
descendsFromImpl, hasMethod, hasMethodImpl, isReference, members, methods, methodsNamed, toReference
arrayOf, arrayOf, descendsFrom, isBoolean, isByte, isCastValid, isChar, isClass, isComparable, isDouble, isFloat, isImplicitCastValid, isInt, isIntOrLess, isLong, isLongOrLess, isNull, isNumeric, isPackage, isPrimitive, isShort, isSubtype, isSubtypeImpl, isThrowable, isType, isUncheckedException, isVoid, numericConversionValid, numericConversionValid, numericConversionValidImpl, numericConversionValidImpl, toClass, toNull, toPackage, toPrimitive, toType, typeEquals
copy, equals, position, typeSystem
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
hasMethod, hasMethodImpl, members, methods, methodsNamed
arrayOf, arrayOf, descendsFrom, descendsFromImpl, isBoolean, isByte, isCastValid, isChar, isClass, isComparable, isDouble, isFloat, isImplicitCastValid, isInt, isIntOrLess, isLong, isLongOrLess, isNull, isNumeric, isPrimitive, isReference, isShort, isSubtype, isSubtypeImpl, isThrowable, isUncheckedException, isVoid, numericConversionValid, numericConversionValid, numericConversionValidImpl, numericConversionValidImpl, toClass, toNull, toPrimitive, toReference, typeEquals
position, typeSystem
protected Type base
protected java.util.List<FieldInstance> fields
protected java.util.List<MethodInstance> methods
protected java.util.List<ClassType> interfaces
protected ArrayType_c()
public ArrayType_c(TypeSystem ts, Position pos, Type base)
protected void init()
protected FieldInstance createLengthFieldInstance()
protected MethodInstance createCloneMethodInstance()
public ArrayType base(Type base)
ArrayType
public Type ultimateBase()
ArrayType
ultimateBase
in interface ArrayType
public int dims()
ArrayType
public java.lang.String toString()
Type
public void print(CodeWriter w)
Type_c
w
.
This implementation generates whatever representation is produced
by toString()
. To satisfy the specification of
Type.toString()
, this implementation needs to be overridden
if toString
does not produce a compilable representation.public java.lang.String translate(Resolver c)
Type
public boolean isCanonical()
TypeObject
isCanonical
in interface TypeObject
isCanonical
in class Type_c
public boolean isArray()
Type
public ArrayType toArray()
Type
public java.util.List<? extends MethodInstance> methods()
ReferenceType
methods
in interface ReferenceType
methods
in class ReferenceType_c
MethodInstance
.MethodInstance
public java.util.List<? extends FieldInstance> fields()
ReferenceType
fields
in interface ReferenceType
fields
in class ReferenceType_c
FieldInstance
.FieldInstance
public MethodInstance cloneMethod()
ArrayType
cloneMethod
in interface ArrayType
public FieldInstance fieldNamed(java.lang.String name)
ReferenceType
name
, or null.fieldNamed
in interface ReferenceType
public FieldInstance lengthField()
ArrayType
lengthField
in interface ArrayType
public Type superType()
ReferenceType
superType
in interface ReferenceType
superType
in class ReferenceType_c
public java.util.List<? extends ReferenceType> interfaces()
ReferenceType
interfaces
in interface ReferenceType
interfaces
in class ReferenceType_c
Type
.Type
public int hashCode()
hashCode
in class TypeObject_c
public boolean equalsImpl(TypeObject t)
TypeObject_c
equalsImpl
in interface TypeObject
equalsImpl
in class TypeObject_c
TypeObject_c.equalsImpl(TypeObject)
,
Object.hashCode()
public boolean typeEqualsImpl(Type t)
Type
typeEqualsImpl
in interface Type
typeEqualsImpl
in class Type_c
t
- Type to compare topublic 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