com.ibm.wala.ipa.callgraph.impl
Class ClassHierarchyMethodTargetSelector

java.lang.Object
  extended by com.ibm.wala.ipa.callgraph.impl.ClassHierarchyMethodTargetSelector
All Implemented Interfaces:
MethodTargetSelector

public class ClassHierarchyMethodTargetSelector
extends java.lang.Object
implements MethodTargetSelector

A MethodTargetSelector that simply looks up the declared type, name and descriptor of a CallSiteReference in the appropriate class hierarchy.


Constructor Summary
ClassHierarchyMethodTargetSelector(IClassHierarchy cha, WarningSet warn)
          Initialization.
 
Method Summary
static boolean feasibleChaResolution(IClassHierarchy cha, CallSiteReference site, IClass dispatchType)
           
 IMethod getCalleeTarget(CGNode caller, CallSiteReference call, IClass receiver)
          This target selector searches the clas hierachy for the method matching the signature of the call that is appropriate for the receiver type.
 boolean mightReturnSyntheticMethod(CGNode caller, CallSiteReference site)
           
 boolean mightReturnSyntheticMethod(MethodReference declaredTarget)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassHierarchyMethodTargetSelector

public ClassHierarchyMethodTargetSelector(IClassHierarchy cha,
                                          WarningSet warn)
Initialization. The class hierarchy is needed for lookups and the warnings are used when the lookups fails (which should never happen).

Parameters:
cha - The class hierarchy to use.
warn - Where and how to emit warnings.
Method Detail

getCalleeTarget

public IMethod getCalleeTarget(CGNode caller,
                               CallSiteReference call,
                               IClass receiver)
This target selector searches the clas hierachy for the method matching the signature of the call that is appropriate for the receiver type.

Specified by:
getCalleeTarget in interface MethodTargetSelector
Parameters:
caller - the GCNode in the call graph containg the call
call - the call site reference of the call site
receiver - the type of the target object or null
Returns:
the method to be called.
Throws:
java.lang.IllegalArgumentException - if call is null

feasibleChaResolution

public static boolean feasibleChaResolution(IClassHierarchy cha,
                                            CallSiteReference site,
                                            IClass dispatchType)
Returns:
true if it may be possible to resolve a call to a site on the concrete type dispatchType

mightReturnSyntheticMethod

public boolean mightReturnSyntheticMethod(CGNode caller,
                                          CallSiteReference site)
Specified by:
mightReturnSyntheticMethod in interface MethodTargetSelector
Returns:
true if there's a possibility that getCalleeTarget here might return a synthetic method.

mightReturnSyntheticMethod

public boolean mightReturnSyntheticMethod(MethodReference declaredTarget)
Specified by:
mightReturnSyntheticMethod in interface MethodTargetSelector
Returns:
true if there's a possibility that getCalleeTarget on this declared tag3et