Class BaseCallGraph

  • All Implemented Interfaces:
    CallGraph

    public abstract class BaseCallGraph
    extends Graph<BaseCallGraph,​CallGraphNode,​CallGraphEdge>
    implements CallGraph
    An instance of CallGraph that provides the basic mechanism to resolve UnresolvedCalls.

    The graph underlying this call graph is built lazily through each call to resolve: querying for information about the graph before the completion of the analysis might lead to wrong results.
    • Constructor Detail

      • BaseCallGraph

        public BaseCallGraph()
    • Method Detail

      • getPossibleTypesOfReceiver

        protected abstract java.util.Collection<Type> getPossibleTypesOfReceiver​(Expression receiver)
                                                                          throws CallResolutionException
        Returns all the possible types of the given expression, that is a receiver of a method call. How we choose this set varies from the call graph algorithm we decide to adopt (e.g., CHA, RTA, 0-CFA, ...)
        Parameters:
        receiver - an expression
        Returns:
        the possible types of the given expression
        Throws:
        CallResolutionException - if the types cannot be computed
      • getCallees

        public java.util.Collection<CodeMember> getCallees​(CodeMember cm)
        Description copied from interface: CallGraph
        Yields all the CodeMembers that are called by the given one. The returned collection might contain partial results if this call graph is not fully built.
        Specified by:
        getCallees in interface CallGraph
        Parameters:
        cm - the target code member
        Returns:
        the collection of called code members
      • getCallers

        public java.util.Collection<CodeMember> getCallers​(CodeMember cm)
        Description copied from interface: CallGraph
        Yields all the CodeMembers that call the given one. The returned collection might contain partial results if this call graph is not fully built.
        Specified by:
        getCallers in interface CallGraph
        Parameters:
        cm - the target code member
        Returns:
        the collection of callers code members
      • getCallSites

        public java.util.Collection<Call> getCallSites​(CodeMember cm)
        Description copied from interface: CallGraph
        Yields all the Calls that targets the given CodeMember. The returned collection might contain partial results if this call graph is not fully built.
        Specified by:
        getCallSites in interface CallGraph
        Parameters:
        cm - the target code member
        Returns:
        the collection of calls that target the code member