@Override public Collection<MethodFlowsGraph> getCalleesFlows(BigBang bb) { if (callee == null || calleeContext == null) { /* This static invoke was not updated. */ return Collections.emptyList(); } else { assert calleeContext != null; MethodFlowsGraph methodFlows = callee.getFlows(calleeContext); return Collections.singletonList(methodFlows); } }
/** * Get the list of all context sensitive callers. * * @param method the method for which the callers are requested * @param context the context for which the callers are requested * @return a list containing all the callers for the given method in the given context */ public List<MethodFlowsGraph> callers(AnalysisMethod method, AnalysisContext context) { MethodFlowsGraph methodFlows = method.getTypeFlow().getFlows(context); return methodFlows.callers(bb); } }
@Override public Collection<MethodFlowsGraph> getCalleesFlows(BigBang bb) { // collect the flow graphs, one for each analysis method, since it is context // insensitive List<MethodFlowsGraph> methodFlowsGraphs = new ArrayList<>(callees.size()); for (AnalysisMethod method : callees.getElements()) { methodFlowsGraphs.add(method.getTypeFlow().getFlows(bb.contextPolicy().emptyContext())); } return methodFlowsGraphs; }
/** * Get the list of all context sensitive callers. * * @return a list containing all the callers for the given context sensitive method */ public List<MethodFlowsGraph> callers(BigBang bb) { /* * This list is seldom needed thus it is created lazily instead of storing a mapping from a * caller context to a caller graph for each method graph. * * TODO cache the result */ List<MethodFlowsGraph> callers = new ArrayList<>(); for (AnalysisMethod caller : method.getJavaInvocations()) { for (MethodFlowsGraph callerFlowGraph : caller.getTypeFlow().getFlows()) { for (InvokeTypeFlow callerInvoke : callerFlowGraph.getInvokeFlows()) { for (MethodFlowsGraph calleeFlowGraph : callerInvoke.getCalleesFlows(bb)) { // 'this' method graph was found among the callees of an invoke flow in one // of the clones of the caller methods, hence we regiter that clone as a // caller for 'this' method clone if (calleeFlowGraph.equals(this)) { callers.add(callerFlowGraph); } } } } } return callers; }