Package proguard.analysis
Class CallResolver.Builder
- java.lang.Object
-
- proguard.analysis.CallResolver.Builder
-
- Enclosing class:
- CallResolver
public static class CallResolver.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder(ClassPool programClassPool, ClassPool libraryClassPool, CallGraph callGraph, CallHandler... visitors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CallResolver
build()
CallResolver.Builder
setArrayValueFactory(ValueFactory arrayValueFactory)
CallResolver.Builder
setClearCallValuesAfterVisit(boolean clearCallValuesAfterVisit)
If true,Call.clearValues()
will be called afterCallHandler.handleCall(Call, TracedStack, TracedVariables)
.CallResolver.Builder
setEvaluateAllCode(boolean evaluateAllCode)
CallResolver.Builder
setExecutingInvocationUnitBuilder(ExecutingInvocationUnit.Builder executingInvocationUnitBuilder)
CallResolver.Builder
setIgnoreExceptions(boolean ignoreExceptions)
If false, exceptions will be taken into account during control flow analysis.CallResolver.Builder
setIncludeSubClasses(boolean includeSubClasses)
If true, virtual calls on class fields, parameters and return values of other methods will take all possible subclasses into account.CallResolver.Builder
setMaxPartialEvaluations(int maxPartialEvaluations)
CallResolver.Builder
setShouldAnalyzeNextCodeAttribute(java.util.function.Supplier<java.lang.Boolean> shouldAnalyzeNextCodeAttribute)
If returns true, the next code attribute will be analyzed.CallResolver.Builder
setSkipIncompleteCalls(boolean skipIncompleteCalls)
If true, any discovered call that would return true forCall.hasIncompleteTarget()
will be discarded and not be forwarded toCallHandler.handleCall(Call, TracedStack, TracedVariables)
.CallResolver.Builder
setUseDominatorAnalysis(boolean useDominatorAnalysis)
If true, a dominator analysis is carried out using theDominatorCalculator
for each method, in order to be able to fill theCall.controlFlowDependent
flag.CallResolver.Builder
useSelectiveParameterReconstruction(java.util.Set<MethodSignature> interestingMethods, java.util.Set<java.util.function.Predicate<Call>> interestingCallPredicates)
When used allows parameter reconstruction based on thePartialEvaluator
to only be executed for the calls that match (1) theinterestingMethods
signatures OR (2) theinterestingCallPredicates
.
-
-
-
Constructor Detail
-
Builder
public Builder(ClassPool programClassPool, ClassPool libraryClassPool, CallGraph callGraph, CallHandler... visitors)
-
-
Method Detail
-
setClearCallValuesAfterVisit
public CallResolver.Builder setClearCallValuesAfterVisit(boolean clearCallValuesAfterVisit)
If true,Call.clearValues()
will be called afterCallHandler.handleCall(Call, TracedStack, TracedVariables)
. This makes it possible to analyze arguments and the return value of calls while still adding them to aCallGraph
afterwards, as call graph analysis itself usually only requires the call locations and their targets, not the arguments or return value.
-
setUseDominatorAnalysis
public CallResolver.Builder setUseDominatorAnalysis(boolean useDominatorAnalysis)
If true, a dominator analysis is carried out using theDominatorCalculator
for each method, in order to be able to fill theCall.controlFlowDependent
flag.
-
setEvaluateAllCode
public CallResolver.Builder setEvaluateAllCode(boolean evaluateAllCode)
-
setIncludeSubClasses
public CallResolver.Builder setIncludeSubClasses(boolean includeSubClasses)
If true, virtual calls on class fields, parameters and return values of other methods will take all possible subclasses into account.This is necessary for a more complete call graph, because the runtime type of these objects is not controlled by the current method. E.g. a method that declares its return type to be of type A might also return an object of type B in case B extends A. The same is true for class fields and parameters, so in order to really find all potential calls, this circumstance needs to be modeled. For objects of declared type
Object
this will be skipped, as the fact that every single Java class is a subclass of object would lead to an immense blow-up of the call graph.
-
setMaxPartialEvaluations
public CallResolver.Builder setMaxPartialEvaluations(int maxPartialEvaluations)
-
setShouldAnalyzeNextCodeAttribute
public CallResolver.Builder setShouldAnalyzeNextCodeAttribute(java.util.function.Supplier<java.lang.Boolean> shouldAnalyzeNextCodeAttribute)
If returns true, the next code attribute will be analyzed. Otherwise, the code attribute will be skipped.
-
setSkipIncompleteCalls
public CallResolver.Builder setSkipIncompleteCalls(boolean skipIncompleteCalls)
If true, any discovered call that would return true forCall.hasIncompleteTarget()
will be discarded and not be forwarded toCallHandler.handleCall(Call, TracedStack, TracedVariables)
.
-
setArrayValueFactory
public CallResolver.Builder setArrayValueFactory(ValueFactory arrayValueFactory)
- Parameters:
arrayValueFactory
- should be set either withDetailedArrayValueFactory
orArrayReferenceValueFactory
- Returns:
CallResolver.Builder
object
-
setIgnoreExceptions
public CallResolver.Builder setIgnoreExceptions(boolean ignoreExceptions)
If false, exceptions will be taken into account during control flow analysis.
-
useSelectiveParameterReconstruction
public CallResolver.Builder useSelectiveParameterReconstruction(java.util.Set<MethodSignature> interestingMethods, java.util.Set<java.util.function.Predicate<Call>> interestingCallPredicates)
When used allows parameter reconstruction based on thePartialEvaluator
to only be executed for the calls that match (1) theinterestingMethods
signatures OR (2) theinterestingCallPredicates
.
-
setExecutingInvocationUnitBuilder
public CallResolver.Builder setExecutingInvocationUnitBuilder(ExecutingInvocationUnit.Builder executingInvocationUnitBuilder)
- Parameters:
executingInvocationUnitBuilder
- a builder for the invocation unit used for particular value analysis.- Returns:
CallResolver.Builder
object
-
build
public CallResolver build()
-
-