com.ibm.wala.j2ee
Class J2EEContextSelector

java.lang.Object
  extended by com.ibm.wala.j2ee.J2EEContextSelector
All Implemented Interfaces:
ContextSelector

public class J2EEContextSelector
extends java.lang.Object
implements ContextSelector

This class provides context selection logic for special J2EE methods.


Field Summary
static MemberReference ExecuteMethod
           
 
Constructor Summary
J2EEContextSelector(ReceiverTypeInferenceCache typeInference, WarningSet warnings)
           
 
Method Summary
 boolean allSitesDispatchIdentically(CGNode node, CallSiteReference site)
           
 boolean contextIsIrrelevant(CGNode node, CallSiteReference site)
           
 int getBoundOnNumberOfTargets(CGNode caller, CallSiteReference site, IMethod callee)
           
 Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey receiver)
          Analyze each call to Command.execute() in a different context
 boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey instance)
           
 void setWarnings(WarningSet newWarnings)
          Bind this object to a new object to track warnings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ExecuteMethod

public static final MemberReference ExecuteMethod
Constructor Detail

J2EEContextSelector

public J2EEContextSelector(ReceiverTypeInferenceCache typeInference,
                           WarningSet warnings)
Method Detail

getCalleeTarget

public Context getCalleeTarget(CGNode caller,
                               CallSiteReference site,
                               IMethod callee,
                               InstanceKey receiver)
Analyze each call to Command.execute() in a different context

Specified by:
getCalleeTarget in interface ContextSelector
site - description of the call site
Returns:
the Context in which the callee should be evaluated, or null if no information is available.
See Also:
com.ibm.wala.ipa.callgraph.ContextSelector#getCalleeTarget(com.ibm.wala.ipa.callgraph.CGNode, com.ibm.wala.classLoader.CallSiteReference, com.ibm.wala.classLoader.IMethod)

getBoundOnNumberOfTargets

public int getBoundOnNumberOfTargets(CGNode caller,
                                     CallSiteReference site,
                                     IMethod callee)
Specified by:
getBoundOnNumberOfTargets in interface ContextSelector
Returns:
a bound on the number of contexts that might be created for this target. -1 if no bound is known.

setWarnings

public void setWarnings(WarningSet newWarnings)
Description copied from interface: ContextSelector
Bind this object to a new object to track warnings

Specified by:
setWarnings in interface ContextSelector

contextIsIrrelevant

public boolean contextIsIrrelevant(CGNode node,
                                   CallSiteReference site)
Specified by:
contextIsIrrelevant in interface ContextSelector
Returns:
true iff this context selector will always return the same context for a given call site, regardless of the receiver object

allSitesDispatchIdentically

public boolean allSitesDispatchIdentically(CGNode node,
                                           CallSiteReference site)
Specified by:
allSitesDispatchIdentically in interface ContextSelector
Returns:
true iff \forAll n \in nodes, \forAll s \in sites with this declaredTarget, the set of targets is the same

mayUnderstand

public boolean mayUnderstand(CGNode caller,
                             CallSiteReference site,
                             IMethod targetMethod,
                             InstanceKey instance)
Specified by:
mayUnderstand in interface ContextSelector
instance - the instance dispatched on. null means "any possible instance"
Returns:
true iff this object may understand how to select a context for the given target