public static class CallResolver.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder(ClassPool programClassPool,
ClassPool libraryClassPool,
CallGraph callGraph,
CallVisitor... visitors) |
Modifier and Type | Method and Description |
---|---|
CallResolver |
build() |
CallResolver.Builder |
setArrayValueFactory(ValueFactory arrayValueFactory) |
CallResolver.Builder |
setClearCallValuesAfterVisit(boolean clearCallValuesAfterVisit)
If true,
Call.clearValues() will be called after CallVisitor.visitCall(Call) . |
CallResolver.Builder |
setEvaluateAllCode(boolean evaluateAllCode)
See
PartialEvaluator.Builder#setEvaluateAllCode(boolean) . |
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)
See
PartialEvaluator.Builder#stopAnalysisAfterNEvaluations(int) . |
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 for
Call.hasIncompleteTarget()
will be discarded and not be forwarded to CallVisitor.visitCall(Call) . |
CallResolver.Builder |
setUseDominatorAnalysis(boolean useDominatorAnalysis)
If true, a dominator analysis is carried out using the
DominatorCalculator for each
method, in order to be able to fill the Call.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 the
PartialEvaluator to only be
executed for the calls that match (1) the interestingMethods signatures OR (2)
the interestingCallPredicates . |
public Builder(ClassPool programClassPool, ClassPool libraryClassPool, CallGraph callGraph, CallVisitor... visitors)
public CallResolver.Builder setClearCallValuesAfterVisit(boolean clearCallValuesAfterVisit)
Call.clearValues()
will be called after CallVisitor.visitCall(Call)
.
This makes it possible to analyze arguments and the return value of calls while still adding
them to a CallGraph
afterwards, as call graph analysis itself usually only requires
the call locations and their targets, not the arguments or return value.public CallResolver.Builder setUseDominatorAnalysis(boolean useDominatorAnalysis)
DominatorCalculator
for each
method, in order to be able to fill the Call.controlFlowDependent
flag.public CallResolver.Builder setEvaluateAllCode(boolean evaluateAllCode)
PartialEvaluator.Builder#setEvaluateAllCode(boolean)
.public CallResolver.Builder setIncludeSubClasses(boolean includeSubClasses)
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.
public CallResolver.Builder setMaxPartialEvaluations(int maxPartialEvaluations)
PartialEvaluator.Builder#stopAnalysisAfterNEvaluations(int)
.public CallResolver.Builder setShouldAnalyzeNextCodeAttribute(java.util.function.Supplier<java.lang.Boolean> shouldAnalyzeNextCodeAttribute)
public CallResolver.Builder setSkipIncompleteCalls(boolean skipIncompleteCalls)
Call.hasIncompleteTarget()
will be discarded and not be forwarded to CallVisitor.visitCall(Call)
.public CallResolver.Builder setArrayValueFactory(ValueFactory arrayValueFactory)
arrayValueFactory
- should be set either with DetailedArrayValueFactory
or
ArrayReferenceValueFactory
CallResolver.Builder
objectpublic CallResolver.Builder setIgnoreExceptions(boolean ignoreExceptions)
public CallResolver.Builder useSelectiveParameterReconstruction(java.util.Set<MethodSignature> interestingMethods, java.util.Set<java.util.function.Predicate<Call>> interestingCallPredicates)
PartialEvaluator
to only be
executed for the calls that match (1) the interestingMethods
signatures OR (2)
the interestingCallPredicates
.public CallResolver.Builder setExecutingInvocationUnitBuilder(ExecutingInvocationUnit.Builder executingInvocationUnitBuilder)
executingInvocationUnitBuilder
- a builder for the invocation unit used for particular
value analysis.CallResolver.Builder
objectpublic CallResolver build()