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 CallResolverbuild()CallResolver.BuildersetArrayValueFactory(ValueFactory arrayValueFactory)CallResolver.BuildersetClearCallValuesAfterVisit(boolean clearCallValuesAfterVisit)If true,Call.clearValues()will be called afterCallHandler.handleCall(Call, TracedStack, TracedVariables).CallResolver.BuildersetEvaluateAllCode(boolean evaluateAllCode)CallResolver.BuildersetExecutingInvocationUnitBuilder(ExecutingInvocationUnit.Builder executingInvocationUnitBuilder)CallResolver.BuildersetIgnoreExceptions(boolean ignoreExceptions)If false, exceptions will be taken into account during control flow analysis.CallResolver.BuildersetIncludeSubClasses(boolean includeSubClasses)If true, virtual calls on class fields, parameters and return values of other methods will take all possible subclasses into account.CallResolver.BuildersetMaxPartialEvaluations(int maxPartialEvaluations)CallResolver.BuildersetShouldAnalyzeNextCodeAttribute(java.util.function.Supplier<java.lang.Boolean> shouldAnalyzeNextCodeAttribute)If returns true, the next code attribute will be analyzed.CallResolver.BuildersetSkipIncompleteCalls(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.BuildersetUseDominatorAnalysis(boolean useDominatorAnalysis)If true, a dominator analysis is carried out using theDominatorCalculatorfor each method, in order to be able to fill theCall.controlFlowDependentflag.CallResolver.BuilderuseSelectiveParameterReconstruction(java.util.Set<MethodSignature> interestingMethods, java.util.Set<java.util.function.Predicate<Call>> interestingCallPredicates)When used allows parameter reconstruction based on thePartialEvaluatorto only be executed for the calls that match (1) theinterestingMethodssignatures 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 aCallGraphafterward, 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 theDominatorCalculatorfor each method, in order to be able to fill theCall.controlFlowDependentflag.
-
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
Objectthis 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 withDetailedArrayValueFactoryorArrayReferenceValueFactory- Returns:
CallResolver.Builderobject
-
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 thePartialEvaluatorto only be executed for the calls that match (1) theinterestingMethodssignatures 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.Builderobject
-
build
public CallResolver build()
-
-