com.ibm.wala.ipa.callgraph
Interface MethodTargetSelector

All Known Implementing Classes:
BypassMethodTargetSelector, ClassHierarchyMethodTargetSelector, CrossLanguageMethodTargetSelector, J2EEMethodTargetSelector, JavaScriptConstructTargetSelector, StandardFunctionTargetSelector

public interface MethodTargetSelector

This interface represents policies for selecting a method to call at a given invocation site. The most obvious such policy would be to look at the relevant class hierarchy and lookup the appropriate method based on the type reference and name and descriptor at the call site. However, other policies are possible for purposes such as providing an abstraction of unanalyzed libraries or specialized J2EE functionality. Such policies are consulted by the different analysis mechanisms, both the flow-based and non-flow algorithms. The current menchanism is that the policy object are registered with the AnalysisOptions object, and all analyses that need to analyze invocations ask that object for the method selector to use. In general, for specialized selectors, it is good practice to build selectors that handle the special case of interest, and otherwise delegate to a child selector. When registering with the AnalysisOptions object, make the child selector be whatever the options object had before.


Method Summary
 IMethod getCalleeTarget(CGNode caller, CallSiteReference site, IClass receiver)
          Given a calling node, a call site and (optionally) a dispatch type, return the target method to be called.
 boolean mightReturnSyntheticMethod(CGNode caller, CallSiteReference site)
           
 boolean mightReturnSyntheticMethod(MethodReference declaredTarget)
           
 

Method Detail

getCalleeTarget

IMethod getCalleeTarget(CGNode caller,
                        CallSiteReference site,
                        IClass receiver)
Given a calling node, a call site and (optionally) a dispatch type, return the target method to be called.

Parameters:
caller - the GCNode in the call graph containg the call
site - the call site reference of the call site
receiver - the type of the target object or null
Returns:
the method to be called.

mightReturnSyntheticMethod

boolean mightReturnSyntheticMethod(CGNode caller,
                                   CallSiteReference site)
Parameters:
caller -
site -
Returns:
true if there's a possibility that getCalleeTarget here might return a synthetic method.

mightReturnSyntheticMethod

boolean mightReturnSyntheticMethod(MethodReference declaredTarget)
Returns:
true if there's a possibility that getCalleeTarget on this declared tag3et