Package sootup.callgraph
Interface LabeledCallGraph<L>
- Type Parameters:
L- the type of the labels attached to the calls
- All Superinterfaces:
CallGraph
- All Known Subinterfaces:
MutableLabeledCallGraph<L>
- All Known Implementing Classes:
LabeledGraphBasedCallGraph
A call graph whose calls (edges) can carry labels of type
L. The label type is not
restricted, e.g. an enum, a record or a sealed interface to combine several kinds of labels:
enum Hotness { HOT, COLD }
LabeledCallGraph<Hotness> cg = LabeledGraphBasedCallGraph.of(callGraph);
Set<Hotness> labels = cg.getLabels(call);
Labels are compared with Object.equals(Object), so a label is stored at most once per
call. Call graphs that do not need labels should keep using CallGraph, which has no
overhead for labels.-
Nested Class Summary
Nested classes/interfaces inherited from interface sootup.callgraph.CallGraph
CallGraph.Call -
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull Set<CallGraph.Call>callsFrom(@NonNull MethodSignature sourceMethod, @NonNull Predicate<? super L> labelFilter) This method returns all outgoing calls of a given method signature that carry at least one label matching the given filter.default @NonNull Set<CallGraph.Call>callsTo(@NonNull MethodSignature targetMethod, @NonNull Predicate<? super L> labelFilter) This method returns all incoming calls of a given method signature that carry at least one label matching the given filter.@NonNull MutableLabeledCallGraph<L>copy()This method copies the call graph including the labels of its calls.getLabels(@NonNull CallGraph.Call call) This method returns all labels attached to a call in the call graph.default booleanhasLabel(@NonNull CallGraph.Call call, @NonNull L label) This method checks if a given label is attached to a call in the call graph.default StringBuildertoDotEdge(CallGraph.Call call) exports a call of the call graph to an edge in a dot file.Methods inherited from interface sootup.callgraph.CallGraph
callCount, callsFrom, callSourcesTo, callsTo, callTargetsFrom, containsCall, containsCall, containsMethod, diff, exportAsDot, exportAsDot, getCalls, getEntryMethods, getMethodSignatures, sortedCallsFrom
-
Method Details
-
getLabels
This method returns all labels attached to a call in the call graph.- Parameters:
call- the requested call in the call graph- Returns:
- an unmodifiable set of the labels of the call. It is empty if the call has no labels or is not contained in the call graph.
-
hasLabel
This method checks if a given label is attached to a call in the call graph.- Parameters:
call- the requested call in the call graphlabel- the requested label- Returns:
- true if the label is attached to the call, otherwise false
-
callsFrom
default @NonNull Set<CallGraph.Call> callsFrom(@NonNull MethodSignature sourceMethod, @NonNull Predicate<? super L> labelFilter) This method returns all outgoing calls of a given method signature that carry at least one label matching the given filter.- Parameters:
sourceMethod- the method signature of the requested node in the call graphlabelFilter- the filter the labels of the calls are tested against- Returns:
- a set of outgoing calls with at least one matching label
-
callsTo
default @NonNull Set<CallGraph.Call> callsTo(@NonNull MethodSignature targetMethod, @NonNull Predicate<? super L> labelFilter) This method returns all incoming calls of a given method signature that carry at least one label matching the given filter.- Parameters:
targetMethod- the method signature of the requested node in the call graphlabelFilter- the filter the labels of the calls are tested against- Returns:
- a set of incoming calls with at least one matching label
-
toDotEdge
exports a call of the call graph to an edge in a dot file. The edge label contains the line number of the call and, if present, the labels of the call. -
copy
@NonNull MutableLabeledCallGraph<L> copy()This method copies the call graph including the labels of its calls.
-