Jode 1.90-CVS
Build Aug 6, 2004

net.sf.jode.type
Class MultiClassType

java.lang.Object
  extended bynet.sf.jode.type.Type
      extended bynet.sf.jode.type.ReferenceType
          extended bynet.sf.jode.type.MultiClassType

public class MultiClassType
extends ReferenceType

This class represents a type aproximation, consisting of multiple interfaces and a class type.

If this is the bottom boundary, this specifies, which class our type must extend and which interfaces it must implement. If this is the top boundary, this gives all interfaces and classes that may extend the type. I.e. at least one interface or class extends the searched type.

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
 
Method Summary
static ReferenceType create(ClassType[] classes)
           
 Type createRangeType(ReferenceType bottomType)
          Create the type corresponding to the range from bottomType to this.
 boolean equals(java.lang.Object o)
           
 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.
 Type getGeneralizedType(Type type)
          Returns the generalized type of this and type.
 Type getHint()
          Returns the hint type of this type set.
 Type getSpecializedType(Type type)
          Returns the specialized type of this and type.
 Type getSubType()
          The sub types of this type.
 java.lang.Class getTypeClass()
          Returns the java.lang.Class representing this type.
 java.lang.String getTypeSignature()
          Returns the type signature of this type.
 int hashCode()
           
 boolean isClassType()
          Checks if this is a class or array type (but not a null type).
 boolean isSubTypeOf(Type type)
          Returns true, iff this type implements all interfaces in type and extends all objects in type.
 boolean isValidType()
          Checks if this type represents a valid type instead of a list of minimum types.
 boolean maybeSubTypeOf(Type type)
          Returns true, iff this type implements all interfaces in type and extends all objects in type.
 java.lang.String toString()
          Returns a string representation describing this type set.
 
Methods inherited from class net.sf.jode.type.ReferenceType
findCommonClassTypes, getSuperType, implementsAllIfaces, intersection
 
Methods inherited from class net.sf.jode.type.Type
getDefaultValue, getTypeCode, isOfType, stackSize, tArray, tClass, tClass, tMethod, tRange, tSubType, tSuperType, tSystemClass, tType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static ReferenceType create(ClassType[] classes)

getSubType

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

Specified by:
getSubType in class ReferenceType

isSubTypeOf

public boolean isSubTypeOf(Type type)
Returns true, iff this type implements all interfaces in type and extends all objects in type.

Overrides:
isSubTypeOf in class Type

maybeSubTypeOf

public boolean maybeSubTypeOf(Type type)
Returns true, iff this type implements all interfaces in type and extends all objects in type.

Overrides:
maybeSubTypeOf in class Type

getHint

public Type getHint()
Description copied from class: Type
Returns the hint type of this type set. This returns the singleton set containing only the `most likely' type in this set. This doesn't work for tError or tUnknown, and may lead to errors for certain range types.

Overrides:
getHint in class Type
Returns:
the hint type.

getCanonic

public Type getCanonic()
Description copied from class: Type
Returns the canonic type of this type set. The intention is, to return for each expression the type, that the java compiler would assign to this expression.

Overrides:
getCanonic in class Type
Returns:
the canonic type.

createRangeType

public Type createRangeType(ReferenceType bottomType)
Create the type corresponding to the range from bottomType to this. This removes all classes that doesn't extend all classes in bottom. If no class remains, this is a type error.

Specified by:
createRangeType in class ReferenceType
Parameters:
bottomType - the bottom type.
Returns:
the range type, or tError if range is empty.

getSpecializedType

public Type getSpecializedType(Type type)
Returns the specialized type of this and type. We simple unify the lists of classes, but simplify them, to remove all classes that are already subtypes of some other class in the other list.

Specified by:
getSpecializedType in class ReferenceType
Parameters:
type - the other type.
Returns:
the specialized type.

getGeneralizedType

public Type getGeneralizedType(Type type)
Returns the generalized type of this and type. We have two classes and multiple interfaces. The result should be the object that is the the super class of both objects and all interfaces, that one class or interface of each type implements.

Specified by:
getGeneralizedType in class ReferenceType
Parameters:
type - the other type.
Returns:
the generalized type

toString

public java.lang.String toString()
Description copied from class: Type
Returns a string representation describing this type set.

Overrides:
toString in class Type
Returns:
a string representation describing this type set.

getTypeSignature

public java.lang.String getTypeSignature()
Description copied from class: Type
Returns the type signature of this type. You should only call this on singleton types.

Overrides:
getTypeSignature in class Type
Returns:
the type (or method) signature of this type.

getTypeClass

public java.lang.Class getTypeClass()
                             throws java.lang.ClassNotFoundException
Description copied from class: Type
Returns the java.lang.Class representing this type. You should only call this on singleton types.

Overrides:
getTypeClass in class Type
Returns:
the Class object representing this type.
Throws:
java.lang.ClassNotFoundException

getCastHelper

public Type getCastHelper(Type fromType)
Checks if we need to cast to a middle type, before we can cast from fromType to this type.

Overrides:
getCastHelper in class Type
Returns:
the middle type, or null if it is not necessary.

isValidType

public boolean isValidType()
Checks if this type represents a valid type instead of a list of minimum types.

Overrides:
isValidType in class Type

isClassType

public boolean isClassType()
Checks if this is a class or array type (but not a null type).

Overrides:
isClassType in class Type
Returns:
true if this is a class or array type.

getDefaultName

public java.lang.String getDefaultName()
Generates the default name, that is the `natural' choice for local of this type.

Overrides:
getDefaultName in class Type
Returns:
the default name of a local of this type.

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object o)

Jode 1.90-CVS
Build Aug 6, 2004

Copyright © 1998-2004 by Jochen Hoenicke.