Jode 1.90-CVS
Build Aug 6, 2004

net.sf.jode.type
Class ReferenceType

java.lang.Object
  extended bynet.sf.jode.type.Type
      extended bynet.sf.jode.type.ReferenceType
Direct Known Subclasses:
ClassType, MultiClassType, NullType

public abstract class ReferenceType
extends Type

This is an abstrace super class of all reference types. Reference types are NullType, MultiClassType, and ClassType with its sub types ClassInfoType, SystemClassType, and ArrayType.

To do intersection on range types, the reference types need three more operations: specialization, generalization and createRange.

specialization chooses all common sub type of two types. It is used to find the bottom of the intersected interval.

generalization chooses the common super type of two types. It is used to find the top of the intersected interval.

When the new interval is created with createRangeType the bottom and top are adjusted so that they only consists of possible types. It then decides, if it needs a range type, or if the reference types already represents all types.

Author:
Jochen Hoenicke

Field Summary
 
Fields inherited from class net.sf.jode.type.Type
EMPTY_IFACES, tBoolByte, tBoolean, tBoolInt, tBoolUInt, tByte, TC_ARRAY, TC_BOOLEAN, TC_BYTE, TC_CHAR, TC_CLASS, TC_CLASSIFACE, TC_DOUBLE, TC_ERROR, TC_FLOAT, TC_INT, TC_INTEGER, TC_LONG, TC_METHOD, TC_NULL, TC_RANGE, TC_SHORT, TC_SYSCLASS, TC_UNKNOWN, TC_VOID, tChar, tCloneable, tComparable, tDouble, tError, tFloat, tInt, tJavaLangClass, tLong, tNull, tObject, tSerializable, tShort, tString, tStringBuffer, tStringBuilder, tUInt, tUnknown, tUObject, tVoid
 
Constructor Summary
ReferenceType(int typecode)
           
 
Method Summary
abstract  Type createRangeType(ReferenceType bottom)
          Creates a range type set of this and bottom.
 Type findCommonClassTypes(java.util.Stack otherTypes)
           
abstract  Type getGeneralizedType(Type type)
          Returns the generalized type set of this and type.
abstract  Type getSpecializedType(Type type)
          Returns the specialized type set of this and type.
abstract  Type getSubType()
          The sub types of this type.
 Type getSuperType()
          The super types of this type.
protected static boolean implementsAllIfaces(ClassInfo clazz, ClassInfo[] ifaces, ClassInfo[] otherIfaces)
          Tells if all otherIfaces, are implemented by at least one ifaces or by clazz.
 Type intersection(Type type)
          Intersect this type with another type and return the new type.
 
Methods inherited from class net.sf.jode.type.Type
getCanonic, getCastHelper, getDefaultName, getDefaultValue, getHint, getTypeClass, getTypeCode, getTypeSignature, isClassType, isOfType, isSubTypeOf, isValidType, maybeSubTypeOf, stackSize, tArray, tClass, tClass, tMethod, toString, tRange, tSubType, tSuperType, tSystemClass, tType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReferenceType

public ReferenceType(int typecode)
Method Detail

getSpecializedType

public abstract Type getSpecializedType(Type type)
Returns the specialized type set of this and type. The result should be a type set, so that every type, extends all types in type and this, iff it extends all types in the resulting type set.

Parameters:
type - the other type.
Returns:
the specialized type.

getGeneralizedType

public abstract Type getGeneralizedType(Type type)
Returns the generalized type set of this and type. The result should be a type set, so that every type, is extended/implemented by one type in this and one type in type, iff it is extended/implemented by one type in the resulting type set.

Parameters:
type - the other type.
Returns:
the generalized type

findCommonClassTypes

public Type findCommonClassTypes(java.util.Stack otherTypes)

createRangeType

public abstract Type createRangeType(ReferenceType bottom)
Creates a range type set of this and bottom. The resulting type set contains all types, that extend all types in bottom and are extended by at least one type in this.
Note that a RangeType will do this, but we normalize the bottom and top set.

Parameters:
bottom - the bottom type.
Returns:
the range type set.

implementsAllIfaces

protected static boolean implementsAllIfaces(ClassInfo clazz,
                                             ClassInfo[] ifaces,
                                             ClassInfo[] otherIfaces)
Tells if all otherIfaces, are implemented by at least one ifaces or by clazz. This is a useful function for generalizing/specializing interface types or arrays. If it can't find all classes in the hierarchy, it will catch this error and return false, i.e. it assumes that the class doesn't implement all interfaces.

Parameters:
clazz - The clazz, can be null.
ifaces - The ifaces.
Returns:
true, if all otherIfaces are implemented, false if unsure or if not all otherIfaces are implemented.

getSuperType

public Type getSuperType()
Description copied from class: Type
The super types of this type.

Overrides:
getSuperType in class Type
Returns:
tSuperType(this).

getSubType

public abstract Type getSubType()
Description copied from class: Type
The sub types of this type.

Overrides:
getSubType in class Type
Returns:
tSubType(this).

intersection

public Type intersection(Type type)
Intersect this type with another type and return the new type.

Overrides:
intersection in class Type
Parameters:
type - the other type.
Returns:
the intersection, or tError, if a type conflict happens.

Jode 1.90-CVS
Build Aug 6, 2004

Copyright © 1998-2004 by Jochen Hoenicke.