public class MultiTypedReferenceValue extends ReferenceValue
TypedReferenceValue
can have multiple potential types during runtime.
E.g. when evaluating SuperClass s = someFlag ? new A() : new B()
,
s may be of type LA; or LB;.Modifier and Type | Field and Description |
---|---|
boolean |
mayBeUnknown |
ALWAYS, MAYBE, NEVER, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INSTRUCTION_OFFSET, TYPE_INTEGER, TYPE_LONG, TYPE_REFERENCE, TYPE_TOP, TYPE_UNKNOWN
Constructor and Description |
---|
MultiTypedReferenceValue(java.util.Set<TypedReferenceValue> potentialTypes,
boolean mayBeUnknown) |
MultiTypedReferenceValue(TypedReferenceValue type,
boolean mayBeUnknown) |
Modifier and Type | Method and Description |
---|---|
ReferenceValue |
cast(java.lang.String type,
Clazz referencedClass,
ValueFactory valueFactory,
boolean alwaysCast)
Returns this ReferenceValue, cast to the given type.
|
int |
equal(MultiTypedReferenceValue other)
Returns whether this
ReferenceValue is equal to the given other
MultiTypedReferenceValue . |
int |
equal(ReferenceValue other)
Returns whether this ReferenceValue is equal to the given other
ReferenceValue.
|
boolean |
equals(java.lang.Object o) |
ReferenceValue |
generalize(MultiTypedReferenceValue other)
Returns the generalization of this
ReferenceValue and the given other
MultiTypedReferenceValue . |
ReferenceValue |
generalize(ReferenceValue other)
Returns the generalization of this ReferenceValue and the given other
ReferenceValue.
|
TypedReferenceValue |
generalize(java.util.Set<TypedReferenceValue> potentialTypes) |
ReferenceValue |
generalize(TypedReferenceValue other)
Returns the generalization of this ReferenceValue and the given other
TypedReferenceValue.
|
ReferenceValue |
generalize(UnknownReferenceValue other)
Returns the generalization of this ReferenceValue and the given other
UnknownReferenceValue.
|
TypedReferenceValue |
getGeneralizedType() |
java.util.Set<TypedReferenceValue> |
getPotentialTypes() |
Clazz |
getReferencedClass()
Returns the class that is referenced by the type.
|
java.lang.String |
getType()
Returns the type.
|
int |
hashCode() |
int |
instanceOf(java.lang.String otherType,
Clazz otherReferencedClass)
Returns whether the type is an instance of the given type.
|
java.lang.String |
internalType()
Returns the internal type of this Value.
|
int |
isNull()
Returns whether this ReferenceValue is
null . |
boolean |
mayBeExtension()
Returns whether the actual type of this ReferenceValue may be an
extension of its type.
|
ReferenceValue |
referenceArrayLoad(IntegerValue indexValue,
ValueFactory valueFactory)
Returns the value of the array at the given index, assuming this type
is a reference array.
|
java.lang.String |
toString() |
arrayLength, arrayStore, computationalType, doubleArrayLoad, equal, equal, equal, equal, equal, equal, equal, equal, floatArrayLoad, generalize, generalize, generalize, generalize, generalize, generalize, generalize, integerArrayLoad, isNotNull, longArrayLoad, notEqual, referenceValue, value
category1Value, isCategory2
category2Value, copyIfMutable, doubleValue, floatValue, instructionOffsetValue, integerValue, isParticular, isSpecific, longValue
public MultiTypedReferenceValue(java.util.Set<TypedReferenceValue> potentialTypes, boolean mayBeUnknown)
public MultiTypedReferenceValue(TypedReferenceValue type, boolean mayBeUnknown)
public TypedReferenceValue generalize(java.util.Set<TypedReferenceValue> potentialTypes)
public java.util.Set<TypedReferenceValue> getPotentialTypes()
public TypedReferenceValue getGeneralizedType()
public java.lang.String getType()
ReferenceValue
getType
in class ReferenceValue
public Clazz getReferencedClass()
ReferenceValue
getReferencedClass
in class ReferenceValue
public boolean mayBeExtension()
ReferenceValue
mayBeExtension
in class ReferenceValue
public int isNull()
ReferenceValue
null
.isNull
in class ReferenceValue
NEVER
, MAYBE
, or ALWAYS
.public int instanceOf(java.lang.String otherType, Clazz otherReferencedClass)
ReferenceValue
instanceOf
in class ReferenceValue
public ReferenceValue cast(java.lang.String type, Clazz referencedClass, ValueFactory valueFactory, boolean alwaysCast)
ReferenceValue
cast
in class ReferenceValue
public ReferenceValue referenceArrayLoad(IntegerValue indexValue, ValueFactory valueFactory)
ReferenceValue
referenceArrayLoad
in class ReferenceValue
public ReferenceValue generalize(ReferenceValue other)
ReferenceValue
generalize
in class ReferenceValue
public ReferenceValue generalize(TypedReferenceValue other)
ReferenceValue
generalize
in class ReferenceValue
public ReferenceValue generalize(UnknownReferenceValue other)
ReferenceValue
generalize
in class ReferenceValue
public ReferenceValue generalize(MultiTypedReferenceValue other)
ReferenceValue
ReferenceValue
and the given other
MultiTypedReferenceValue
.generalize
in class ReferenceValue
public int equal(ReferenceValue other)
ReferenceValue
equal
in class ReferenceValue
NEVER
, MAYBE
, or ALWAYS
.public int equal(MultiTypedReferenceValue other)
ReferenceValue
ReferenceValue
is equal to the given other
MultiTypedReferenceValue
.equal
in class ReferenceValue
NEVER
, MAYBE
, or ALWAYS
.public java.lang.String internalType()
Value
internalType
in class Value
TypeConstants.BOOLEAN
,
TypeConstants.BYTE
,
TypeConstants.CHAR
,
TypeConstants.SHORT
,
TypeConstants.INT
,
TypeConstants.LONG
,
TypeConstants.FLOAT
,
TypeConstants.DOUBLE
,
TypeConstants.CLASS_START ... TypeConstants.CLASS_END
, or
an array type containing any of these types (always as String).public boolean equals(java.lang.Object o)
equals
in class ReferenceValue
public int hashCode()
hashCode
in class ReferenceValue
public java.lang.String toString()
toString
in class ReferenceValue