Package sootup.callgraph
Class ClassHierarchyAnalysisAlgorithm
java.lang.Object
sootup.callgraph.AbstractCallGraphAlgorithm
sootup.callgraph.ClassHierarchyAnalysisAlgorithm
- All Implemented Interfaces:
CallGraphAlgorithm
This class implements the Class Hierarchy Analysis call graph algorithm. In this algorithm, every
virtual call is resolved to the all implemented overwritten methods of subclasses in the entire
class path.
-
Field Summary
Fields inherited from class sootup.callgraph.AbstractCallGraphAlgorithm
view
-
Constructor Summary
ConstructorDescriptionThe constructor of the CHA algorithm. -
Method Summary
Modifier and TypeMethodDescriptionThis method initializes and starts the call graph algorithm without given entry points.initialize
(List<MethodSignature> entryPoints) This method initializes and starts the call graph algorithm with given entry points.protected void
postProcessingMethod
(View view, MethodSignature sourceMethod, Deque<MethodSignature> workList, MutableCallGraph cg) This method enables optional post-processing of a method in the call graph algorithmprotected void
preProcessingMethod
(View view, MethodSignature sourceMethod, Deque<MethodSignature> workList, MutableCallGraph cg) This method enables optional pre-processing of a method in the call graph algorithmprotected Stream<MethodSignature>
resolveCall
(SootMethod method, InvokableStmt invokableStmt) In the CHA algorithm, every virtual call is resolved by only using the hierarchy.Methods inherited from class sootup.callgraph.AbstractCallGraphAlgorithm
addCallToCG, addClass, findConcreteMethod, findMainMethod, getClinitFromEntryPoints, initializeCallGraph, resolveAllCallsFromSourceMethod, resolveAllImplicitCallsFromSourceMethod, resolveAllStaticInitializerCalls, resolveConcreteDispatch
-
Constructor Details
-
ClassHierarchyAnalysisAlgorithm
The constructor of the CHA algorithm.- Parameters:
view
- it contains the data of the classes and methods
-
-
Method Details
-
initialize
Description copied from interface:CallGraphAlgorithm
This method initializes and starts the call graph algorithm without given entry points. Before the algorithm is started, all main methods are searched and set as entry points.- Returns:
- a generated call graph with every main class as starting point.
-
initialize
Description copied from interface:CallGraphAlgorithm
This method initializes and starts the call graph algorithm with given entry points. The entry points define the start methods in the call graph algorithm.- Parameters:
entryPoints
- a list of entry points for the call graph algorithm. The algorithm starts at these methods and inspects all reachable methods.- Returns:
- a generated call graph with every entry point as starting point.
-
resolveCall
@Nonnull protected Stream<MethodSignature> resolveCall(SootMethod method, InvokableStmt invokableStmt) In the CHA algorithm, every virtual call is resolved by only using the hierarchy. Every subclass of the class is considered as target if it contains an implementation of the methods called in the invoke expression.- Specified by:
resolveCall
in classAbstractCallGraphAlgorithm
- Parameters:
method
- the method object that contains the given invoke expression in the body.invokableStmt
- it contains the call which is resolved.- Returns:
- a stream containing all reachable method signatures after applying the CHA call graph algorithm
-
postProcessingMethod
protected void postProcessingMethod(View view, MethodSignature sourceMethod, @Nonnull Deque<MethodSignature> workList, @Nonnull MutableCallGraph cg) Description copied from class:AbstractCallGraphAlgorithm
This method enables optional post-processing of a method in the call graph algorithm- Specified by:
postProcessingMethod
in classAbstractCallGraphAlgorithm
- Parameters:
view
- it contains classes and the type hierarchy.sourceMethod
- the processed methodworkList
- the current work list that might be extendedcg
- the current cg that might be extended
-
preProcessingMethod
protected void preProcessingMethod(View view, MethodSignature sourceMethod, @Nonnull Deque<MethodSignature> workList, @Nonnull MutableCallGraph cg) Description copied from class:AbstractCallGraphAlgorithm
This method enables optional pre-processing of a method in the call graph algorithm- Specified by:
preProcessingMethod
in classAbstractCallGraphAlgorithm
- Parameters:
view
- viewsourceMethod
- the processed methodworkList
- the current work list that might be extendedcg
- the current cg that might be extended
-