Package javassist.bytecode.analysis
Class MultiType
- java.lang.Object
-
- javassist.bytecode.analysis.Type
-
- javassist.bytecode.analysis.MultiType
-
public class MultiType extends Type
MultiType represents an unresolved type. Whenever twoTypeinstances are merged, if they share more than one super type (either an interface or a superclass), then aMultiTypeis used to represent the possible super types. The goal of aMultiTypeis to reduce the set of possible types down to a single resolved type. This is done by eliminating non-assignable types from the typeset when theMultiTypeis passed as an argument toType.isAssignableFrom(Type), as well as removing non-intersecting types during a merge. Note: Currently theMultiTypeinstance is reused as much as possible so that updates are visible from all frames. In addition, allMultiTypemerge paths are also updated. This is somewhat hackish, but it appears to handle most scenarios.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanchangedprivate java.util.Mapinterfacesprivate MultiTypemergeSourceprivate TypepotentialClassprivate Typeresolved
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)private java.util.MapgetAllMultiInterfaces(MultiType type)TypegetComponent()Always returns null since this type is never used for an array.CtClassgetCtClass()Gets the class that corresponds with this type.intgetSize()Always returns 1, since this type is a reference.private booleaninMergeSource(MultiType source)booleanisArray()Always reutnrs false since this type is never used for an arraybooleanisAssignableFrom(Type type)Determines whether this type is assignable, to the passed type.booleanisAssignableTo(Type type)booleanisReference()Always returns true, since this type is always a reference.Typemerge(Type type)Finds the common base type, or interface which both this and the specified type can be assigned.private java.util.MapmergeMultiAndSingle(MultiType multi, Type single)private java.util.MapmergeMultiInterfaces(MultiType type1, MultiType type2)(package private) booleanpopChanged()Returns true if the internal state has changed.private voidpropogateResolved()private voidpropogateState()java.lang.StringtoString()-
Methods inherited from class javassist.bytecode.analysis.Type
arrayName, eq, findCommonInterfaces, get, getAllInterfaces, getDeclaredInterfaces, getDimensions, getRootComponent, isSpecial
-
-
-
-
Constructor Detail
-
MultiType
public MultiType(java.util.Map interfaces)
-
MultiType
public MultiType(java.util.Map interfaces, Type potentialClass)
-
-
Method Detail
-
getCtClass
public CtClass getCtClass()
Gets the class that corresponds with this type. If this information is not yet known, java.lang.Object will be returned.- Overrides:
getCtClassin classType- Returns:
- the class for this type, or null if special
-
getComponent
public Type getComponent()
Always returns null since this type is never used for an array.- Overrides:
getComponentin classType- Returns:
- the array component if an array, otherwise null
-
getSize
public int getSize()
Always returns 1, since this type is a reference.
-
isArray
public boolean isArray()
Always reutnrs false since this type is never used for an array
-
popChanged
boolean popChanged()
Returns true if the internal state has changed.- Overrides:
popChangedin classType
-
isAssignableFrom
public boolean isAssignableFrom(Type type)
Description copied from class:TypeDetermines whether this type is assignable, to the passed type. A type is assignable to another if it is either the same type, or a sub-type.- Overrides:
isAssignableFromin classType- Parameters:
type- the type to test assignability to- Returns:
- true if this is assignable to type, otherwise false
-
isAssignableTo
public boolean isAssignableTo(Type type)
-
propogateState
private void propogateState()
-
propogateResolved
private void propogateResolved()
-
isReference
public boolean isReference()
Always returns true, since this type is always a reference.- Overrides:
isReferencein classType- Returns:
- true
-
getAllMultiInterfaces
private java.util.Map getAllMultiInterfaces(MultiType type)
-
inMergeSource
private boolean inMergeSource(MultiType source)
-
merge
public Type merge(Type type)
Description copied from class:TypeFinds the common base type, or interface which both this and the specified type can be assigned. If there is more than one possible answer, then aMultiType, or aMultiArrayTypeis returned. Multi-types have special rules, and successive merges and assignment tests on them will alter their internal state, as well as other multi-types they have been merged with. This method is used by the data-flow analyzer to merge the type state from multiple branches.
-
-