|
Jode 1.90-CVS Build Aug 6, 2004 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jode.type.Type
This is my type class. It differs from java.lang.class, in that it
represents a set of types. Since most times this set is infinite, it
needs a special representation.
The main operation on a type sets are tSuperType, tSubType and
intersection.
Field Summary | |
static ClassType[] |
EMPTY_IFACES
|
static Type |
tBoolByte
This type represents the set of the boolean and byte type. |
static Type |
tBoolean
This type represents the singleton set containing the boolean type. |
static Type |
tBoolInt
This type represents the set of the boolean and int type. |
static Type |
tBoolUInt
This type represents the set of boolean and all integer types, up to 32 bit. |
static Type |
tByte
This type represents the singleton set containing the byte type. |
static int |
TC_ARRAY
|
static int |
TC_BOOLEAN
|
static int |
TC_BYTE
|
static int |
TC_CHAR
|
static int |
TC_CLASS
|
static int |
TC_CLASSIFACE
|
static int |
TC_DOUBLE
|
static int |
TC_ERROR
|
static int |
TC_FLOAT
|
static int |
TC_INT
|
static int |
TC_INTEGER
|
static int |
TC_LONG
|
static int |
TC_METHOD
|
static int |
TC_NULL
|
static int |
TC_RANGE
|
static int |
TC_SHORT
|
static int |
TC_SYSCLASS
|
static int |
TC_UNKNOWN
|
static int |
TC_VOID
|
static Type |
tChar
This type represents the singleton set containing the char type. |
static SystemClassType |
tCloneable
This type represents the singleton set containing java.lang.Comparable . |
static SystemClassType |
tComparable
This type represents the singleton set containing java.lang.Comparable . |
static Type |
tDouble
This type represents the singleton set containing the double type. |
static Type |
tError
This type represents the empty set, and probably means, that something has gone wrong. |
static Type |
tFloat
This type represents the singleton set containing the float type. |
static Type |
tInt
This type represents the singleton set containing the int type. |
static SystemClassType |
tJavaLangClass
This type represents the singleton set containing java.lang.Class . |
static Type |
tLong
This type represents the singleton set containing the long type. |
static ReferenceType |
tNull
This type represents the singleton set containing the special null type (the type of null). |
static SystemClassType |
tObject
This type represents the singleton set containing java.lang.Object . |
static SystemClassType |
tSerializable
This type represents the singleton set containing java.lang.Comparable . |
static Type |
tShort
This type represents the singleton set containing the short type. |
static SystemClassType |
tString
This type represents the singleton set containing java.lang.String . |
static SystemClassType |
tStringBuffer
This type represents the singleton set containing java.lang.StringBuffer . |
static SystemClassType |
tStringBuilder
This type represents the singleton set containing java.lang.StringBuffer . |
static Type |
tUInt
This type represents the set of all integer types, up to 32 bit. |
static Type |
tUnknown
This type represents the set of all possible types. |
static Type |
tUObject
This type represents the set of all reference types, including class types, array types, interface types and the null type. |
static Type |
tVoid
This type represents the void type. |
Constructor Summary | |
protected |
Type(int tc)
Create a new type with the given type code. |
Method Summary | |
Type |
getCanonic()
Returns the canonic type of this type set. |
Type |
getCastHelper(Type fromType)
Checks if we need to cast to a middle type, before we can cast from fromType to this type. |
java.lang.String |
getDefaultName()
Generates the default name, that is the `natural' choice for local of this type. |
java.lang.Object |
getDefaultValue()
Generates the default value, that is the initial value of a field of this type. |
Type |
getHint()
Returns the hint type of this type set. |
Type |
getSubType()
The sub types of this type. |
Type |
getSuperType()
The super types of this type. |
java.lang.Class |
getTypeClass()
Returns the java.lang.Class representing this type. |
int |
getTypeCode()
Returns the type code of this type. |
java.lang.String |
getTypeSignature()
Returns the type signature of this type. |
Type |
intersection(Type type)
Intersect this set of types with another type set and return the intersection. |
boolean |
isClassType()
Checks if this is a class or array type (but not a null type). |
boolean |
isOfType(Type type)
Check if this type set and the other type set are not disjunct. |
boolean |
isSubTypeOf(Type type)
Returns true, if this is a sub type of type. |
boolean |
isValidType()
Checks if this type represents a valid singleton type. |
boolean |
maybeSubTypeOf(Type type)
Returns true, if this is a sub type of type. |
int |
stackSize()
Returns the number of stack/local entries an object of this type occupies. |
static Type |
tArray(Type type)
Generate/look up the set of the array type whose element types are in the given type set. |
static ClassType |
tClass(ClassInfo clazzinfo)
Generate the singleton set of the type represented by the given class info. |
static ClassType |
tClass(ClassPath classPath,
java.lang.String clazzname)
Generate the singleton set of the type represented by the given class name. |
static MethodType |
tMethod(ClassPath cp,
java.lang.String signature)
Generate/look up the method type for the given signature |
java.lang.String |
toString()
Returns a string representation describing this type set. |
static Type |
tRange(ReferenceType bottom,
ReferenceType top)
Generate the range type from bottom to top. |
static Type |
tSubType(Type type)
Generate the set of types, which can be casted to one of the types in type by a widening cast. |
static Type |
tSuperType(Type type)
Generate the set of types, to which one of the types in type can be casted to by a widening cast. |
static SystemClassType |
tSystemClass(java.lang.String clazzName,
ClassType superClass,
ClassType[] ifaces,
boolean isFinal,
boolean isInterface)
Generate the singleton set of the type represented by the given class name. |
static Type |
tType(ClassPath cp,
java.lang.String type)
Generate the singleton set of the type represented by the given string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int TC_BOOLEAN
public static final int TC_BYTE
public static final int TC_CHAR
public static final int TC_SHORT
public static final int TC_INT
public static final int TC_LONG
public static final int TC_FLOAT
public static final int TC_DOUBLE
public static final int TC_NULL
public static final int TC_ARRAY
public static final int TC_CLASS
public static final int TC_VOID
public static final int TC_METHOD
public static final int TC_ERROR
public static final int TC_UNKNOWN
public static final int TC_RANGE
public static final int TC_INTEGER
public static final int TC_SYSCLASS
public static final int TC_CLASSIFACE
public static final Type tBoolean
public static final Type tByte
public static final Type tChar
public static final Type tShort
public static final Type tInt
public static final Type tLong
public static final Type tFloat
public static final Type tDouble
public static final Type tVoid
public static final Type tError
public static final Type tUnknown
public static final Type tUInt
public static final Type tBoolInt
public static final Type tBoolUInt
public static final Type tBoolByte
public static final ClassType[] EMPTY_IFACES
public static final SystemClassType tObject
java.lang.Object
.
public static final ReferenceType tNull
public static final Type tUObject
public static final SystemClassType tSerializable
java.lang.Comparable
.
public static final SystemClassType tCloneable
java.lang.Comparable
.
public static final SystemClassType tComparable
java.lang.Comparable
.
public static final SystemClassType tString
java.lang.String
.
public static final SystemClassType tStringBuffer
java.lang.StringBuffer
.
public static final SystemClassType tStringBuilder
java.lang.StringBuffer
.
public static final SystemClassType tJavaLangClass
java.lang.Class
.
Constructor Detail |
protected Type(int tc)
Method Detail |
public static final Type tType(ClassPath cp, java.lang.String type)
type
- the type signature (or method signature).
public static final ClassType tClass(ClassPath classPath, java.lang.String clazzname)
clazzname
- the full qualified name of the class.
The packages may be separated by `.' or `/'.
public static final SystemClassType tSystemClass(java.lang.String clazzName, ClassType superClass, ClassType[] ifaces, boolean isFinal, boolean isInterface)
public static final ClassType tClass(ClassInfo clazzinfo)
clazzinfo
- the net.sf.jode.bytecode.ClassInfo.
public static final Type tArray(Type type)
type
- the element types (which may be the empty set tError).
public static MethodType tMethod(ClassPath cp, java.lang.String signature)
signature
- the method decriptor.
public static final Type tRange(ReferenceType bottom, ReferenceType top)
bottom
- the bottom type.top
- the top type.
public static Type tSuperType(Type type)
type
- a set of types.
public static Type tSubType(Type type)
type
- a set of types.
public Type getSubType()
public Type getSuperType()
public Type getHint()
tError
or tUnknown
, and may lead
to errors for certain range types.
public Type getCanonic()
public final int getTypeCode()
public int stackSize()
public boolean isSubTypeOf(Type type)
public boolean maybeSubTypeOf(Type type)
public Type intersection(Type type)
type
- the other type set.
public Type getCastHelper(Type fromType)
public boolean isValidType()
public boolean isClassType()
public boolean isOfType(Type type)
type
- the other type set.
public java.lang.String getDefaultName()
public java.lang.Object getDefaultValue()
public java.lang.String getTypeSignature()
public java.lang.Class getTypeClass() throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.lang.String toString()
|
Jode 1.90-CVS Build Aug 6, 2004 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |