public class ReferenceTracingValueFactory extends java.lang.Object implements InstructionVisitor, ValueFactory
ValueFactory
tags newly created reference values so they can be traced
throughout the execution of a method.TracedReferenceValue
,
InstructionOffsetValue
Constructor and Description |
---|
ReferenceTracingValueFactory(ValueFactory valueFactory)
Creates a new ReferenceTracingValueFactory that attaches instruction
offset values based on being used as an instruction visitor.
|
ReferenceTracingValueFactory(ValueFactory valueFactory,
boolean preserveTraceValueOnCasts)
Creates a new ReferenceTracingValueFactory that attaches instruction
offset values based on being used as an instruction visitor.
|
Modifier and Type | Method and Description |
---|---|
TracedReferenceValue |
cast(TracedReferenceValue referenceValue,
java.lang.String type,
Clazz referencedClass,
boolean alwaysCast)
Casts a given traced reference value to the given type, either keeping
its trace value or setting a new one.
|
ReferenceValue |
createArrayReferenceValue(java.lang.String type,
Clazz referencedClass,
IntegerValue arrayLength)
Creates a new ReferenceValue that represents a non-null array with
elements of the given type, with the given length.
|
ReferenceValue |
createArrayReferenceValue(java.lang.String type,
Clazz referencedClass,
IntegerValue arrayLength,
java.lang.Object elementValues)
Creates a new ReferenceValue that represents an array with elements of
the given type, with the given length and initial element values.
|
DoubleValue |
createDoubleValue()
Creates a new DoubleValue with an undefined value.
|
DoubleValue |
createDoubleValue(double value)
Creates a new DoubleValue with a given particular value.
|
FloatValue |
createFloatValue()
Creates a new FloatValue with an undefined value.
|
FloatValue |
createFloatValue(float value)
Creates a new FloatValue with a given particular value.
|
IntegerValue |
createIntegerValue()
Creates a new IntegerValue with an undefined value.
|
IntegerValue |
createIntegerValue(int value)
Creates a new IntegerValue with a given particular value.
|
IntegerValue |
createIntegerValue(int min,
int max)
Creates a new IntegerValue with a given possible range.
|
LongValue |
createLongValue()
Creates a new LongValue with an undefined value.
|
LongValue |
createLongValue(long value)
Creates a new LongValue with a given particular value.
|
ReferenceValue |
createReferenceValue()
Creates a new ReferenceValue of an undefined type.
|
ReferenceValue |
createReferenceValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull)
Creates a new ReferenceValue that represents the given type.
|
ReferenceValue |
createReferenceValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
Clazz creationClass,
Method creationMethod,
int creationOffset)
Creates a new ReferenceValue that represents the given type, created at the
specified code location.
|
ReferenceValue |
createReferenceValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
Clazz creationClass,
Method creationMethod,
int creationOffset,
java.lang.Object value)
Creates a new ReferenceValue that represents the given type, created at the
specified code location.
|
ReferenceValue |
createReferenceValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
java.lang.Object value)
Creates a new ReferenceValue that represents the given type.
|
ReferenceValue |
createReferenceValueForId(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
java.lang.Object id)
Creates a new ReferenceValue that represents the given type with a specified ID.
|
ReferenceValue |
createReferenceValueForId(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull,
java.lang.Object id,
java.lang.Object value)
Creates a new ReferenceValue that represents the given type with a specified ID.
|
ReferenceValue |
createReferenceValueNull()
Creates a new ReferenceValue that represents
null . |
Value |
createValue(java.lang.String type,
Clazz referencedClass,
boolean mayBeExtension,
boolean mayBeNull)
Creates a new Value of the given type.
|
void |
setTraceValue(Value traceValue) |
ReferenceValue |
trace(ReferenceValue referenceValue)
Attaches the current trace value to given reference value.
|
Value |
trace(Value value)
Attaches the current trace value to given value, if it is a reference
value.
|
void |
visitAnyInstruction(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
Instruction instruction)
Visits any Instruction instance.
|
void |
visitConstantInstruction(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
ConstantInstruction constantInstruction) |
void |
visitSimpleInstruction(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
SimpleInstruction simpleInstruction) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
visitAnySwitchInstruction, visitBranchInstruction, visitLookUpSwitchInstruction, visitTableSwitchInstruction, visitVariableInstruction
createReferenceValue, createReferenceValue
public ReferenceTracingValueFactory(ValueFactory valueFactory)
cast(proguard.evaluation.value.TracedReferenceValue, java.lang.String, proguard.classfile.Clazz, boolean)
method.valueFactory
- the value factory that creates the actual values.public ReferenceTracingValueFactory(ValueFactory valueFactory, boolean preserveTraceValueOnCasts)
valueFactory
- the value factory that creates the
actual values.preserveTraceValueOnCasts
- specifies whether to preserve the
trace value for reference values that
are passed to the cast(proguard.evaluation.value.TracedReferenceValue, java.lang.String, proguard.classfile.Clazz, boolean)
method.public void setTraceValue(Value traceValue)
public TracedReferenceValue cast(TracedReferenceValue referenceValue, java.lang.String type, Clazz referencedClass, boolean alwaysCast)
public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
InstructionVisitor
visitAnyInstruction
in interface InstructionVisitor
public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
visitSimpleInstruction
in interface InstructionVisitor
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
visitConstantInstruction
in interface InstructionVisitor
public Value createValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull)
ValueFactory
createValue
in interface ValueFactory
public IntegerValue createIntegerValue()
ValueFactory
createIntegerValue
in interface ValueFactory
public IntegerValue createIntegerValue(int value)
ValueFactory
createIntegerValue
in interface ValueFactory
public IntegerValue createIntegerValue(int min, int max)
ValueFactory
createIntegerValue
in interface ValueFactory
public LongValue createLongValue()
ValueFactory
createLongValue
in interface ValueFactory
public LongValue createLongValue(long value)
ValueFactory
createLongValue
in interface ValueFactory
public FloatValue createFloatValue()
ValueFactory
createFloatValue
in interface ValueFactory
public FloatValue createFloatValue(float value)
ValueFactory
createFloatValue
in interface ValueFactory
public DoubleValue createDoubleValue()
ValueFactory
createDoubleValue
in interface ValueFactory
public DoubleValue createDoubleValue(double value)
ValueFactory
createDoubleValue
in interface ValueFactory
public ReferenceValue createReferenceValue()
ValueFactory
createReferenceValue
in interface ValueFactory
public ReferenceValue createReferenceValueNull()
ValueFactory
null
.createReferenceValueNull
in interface ValueFactory
public ReferenceValue createReferenceValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull)
ValueFactory
null
, the ReferenceValue represents null
.createReferenceValue
in interface ValueFactory
public ReferenceValue createReferenceValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, java.lang.Object value)
ValueFactory
null
, the ReferenceValue represents null
.
The object is the actual value of the reference during execution (can be null).createReferenceValue
in interface ValueFactory
public ReferenceValue createReferenceValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, Clazz creationClass, Method creationMethod, int creationOffset)
ValueFactory
null
, the ReferenceValue represents null
.
The object is the actual value of the reference during execution (can be null).createReferenceValue
in interface ValueFactory
public ReferenceValue createReferenceValue(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, Clazz creationClass, Method creationMethod, int creationOffset, java.lang.Object value)
ValueFactory
null
, the ReferenceValue represents null
.
The object is the actual value of the reference during execution (can be null).createReferenceValue
in interface ValueFactory
public ReferenceValue createReferenceValueForId(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, java.lang.Object id)
ValueFactory
null
, the ReferenceValue represents null
.createReferenceValueForId
in interface ValueFactory
public ReferenceValue createReferenceValueForId(java.lang.String type, Clazz referencedClass, boolean mayBeExtension, boolean mayBeNull, java.lang.Object id, java.lang.Object value)
ValueFactory
null
, the ReferenceValue represents null
.
The object is the actual value of the reference during execution (can be null).createReferenceValueForId
in interface ValueFactory
public ReferenceValue createArrayReferenceValue(java.lang.String type, Clazz referencedClass, IntegerValue arrayLength)
ValueFactory
createArrayReferenceValue
in interface ValueFactory
public ReferenceValue createArrayReferenceValue(java.lang.String type, Clazz referencedClass, IntegerValue arrayLength, java.lang.Object elementValues)
createArrayReferenceValue
in interface ValueFactory
public Value trace(Value value)
public ReferenceValue trace(ReferenceValue referenceValue)