proguard.evaluation.value
Class ReferenceValue

java.lang.Object
  extended by proguard.evaluation.value.Value
      extended by proguard.evaluation.value.Category1Value
          extended by proguard.evaluation.value.ReferenceValue

public class ReferenceValue
extends Category1Value

This class represents a partially evaluated reference value. It has a type and a flag that indicates whether the value could be null. If the type is null, the value is null.


Field Summary
protected  boolean mayBeNull
           
protected  Clazz referencedClass
           
protected  java.lang.String type
           
 
Fields inherited from class proguard.evaluation.value.Value
ALWAYS, MAYBE, NEVER, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INSTRUCTION_OFFSET, TYPE_INTEGER, TYPE_LONG, TYPE_REFERENCE, TYPE_TOP
 
Constructor Summary
ReferenceValue(java.lang.String type, Clazz referencedClass, boolean mayBeNull)
          Creates a new ReferenceValue.
 
Method Summary
 IntegerValue arrayLength(ValueFactory valueFactory)
          Returns the length of the array, assuming this type is an array.
 Value arrayLoad(IntegerValue integerValue, ValueFactory valueFactory)
          Returns the value of the array at the given index, assuming this type is an array.
 int computationalType()
          Returns the computational type of this Value.
 int equal(ReferenceValue other)
          Returns whether this ReferenceValue is equal to the given other ReferenceValue.
 boolean equals(java.lang.Object object)
           
 ReferenceValue generalize(ReferenceValue other)
          Returns the generalization of this ReferenceValue and the given other ReferenceValue.
 Value generalize(Value other)
          Returns the generalization of this Value and the given other Value.
 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 isNotNull()
          Returns whether this ReferenceValue is not null.
 int isNull()
          Returns whether the type is null.
 boolean isParticular()
          Returns whether this Value represents a single particular (known) value.
 int notEqual(ReferenceValue other)
          Returns whether this ReferenceValue and the given ReferenceValue are different.
 ReferenceValue referenceValue()
          Returns this Value as a ReferenceValue.
 java.lang.String toString()
           
 
Methods inherited from class proguard.evaluation.value.Category1Value
category1Value, isCategory2
 
Methods inherited from class proguard.evaluation.value.Value
category2Value, doubleValue, floatValue, instructionOffsetValue, integerValue, isSpecific, longValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected final java.lang.String type

referencedClass

protected final Clazz referencedClass

mayBeNull

protected final boolean mayBeNull
Constructor Detail

ReferenceValue

public ReferenceValue(java.lang.String type,
                      Clazz referencedClass,
                      boolean mayBeNull)
Creates a new ReferenceValue.

Method Detail

getType

public java.lang.String getType()
Returns the type.


getReferencedClass

public Clazz getReferencedClass()
Returns the class that is referenced by the type.


isNull

public int isNull()
Returns whether the type is null.


instanceOf

public int instanceOf(java.lang.String otherType,
                      Clazz otherReferencedClass)
Returns whether the type is an instance of the given type.


arrayLength

public IntegerValue arrayLength(ValueFactory valueFactory)
Returns the length of the array, assuming this type is an array.


arrayLoad

public Value arrayLoad(IntegerValue integerValue,
                       ValueFactory valueFactory)
Returns the value of the array at the given index, assuming this type is an array.


generalize

public ReferenceValue generalize(ReferenceValue other)
Returns the generalization of this ReferenceValue and the given other ReferenceValue.


equal

public int equal(ReferenceValue other)
Returns whether this ReferenceValue is equal to the given other ReferenceValue.

Returns:
NEVER, MAYBE, or ALWAYS.

isNotNull

public final int isNotNull()
Returns whether this ReferenceValue is not null.

Returns:
NEVER, MAYBE, or ALWAYS.

notEqual

public final int notEqual(ReferenceValue other)
Returns whether this ReferenceValue and the given ReferenceValue are different.

Returns:
NEVER, MAYBE, or ALWAYS.

referenceValue

public final ReferenceValue referenceValue()
Description copied from class: Value
Returns this Value as a ReferenceValue.

Overrides:
referenceValue in class Value

generalize

public final Value generalize(Value other)
Description copied from class: Value
Returns the generalization of this Value and the given other Value.

Specified by:
generalize in class Value

isParticular

public boolean isParticular()
Description copied from class: Value
Returns whether this Value represents a single particular (known) value.

Overrides:
isParticular in class Value

computationalType

public final int computationalType()
Description copied from class: Value
Returns the computational type of this Value.

Specified by:
computationalType in class Value
Returns:
TYPE_INTEGER, TYPE_LONG, TYPE_FLOAT, TYPE_DOUBLE, TYPE_REFERENCE, or TYPE_INSTRUCTION_OFFSET.

internalType

public final java.lang.String internalType()
Description copied from class: Value
Returns the internal type of this Value.

Specified by:
internalType in class Value
Returns:
ClassConstants.INTERNAL_TYPE_BOOLEAN, ClassConstants.INTERNAL_TYPE_BYTE, ClassConstants.INTERNAL_TYPE_CHAR, ClassConstants.INTERNAL_TYPE_SHORT, ClassConstants.INTERNAL_TYPE_INT, ClassConstants.INTERNAL_TYPE_LONG, ClassConstants.INTERNAL_TYPE_FLOAT, ClassConstants.INTERNAL_TYPE_DOUBLE, ClassConstants.INTERNAL_TYPE_CLASS_START ... ClassConstants.INTERNAL_TYPE_CLASS_END, or an array type containing any of these types (always as String).

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object