Class ClassFactoryContextSelector

java.lang.Object
com.ibm.wala.analysis.reflection.ClassFactoryContextSelector
All Implemented Interfaces:
ContextSelector

public class ClassFactoryContextSelector extends Object implements ContextSelector
A ContextSelector to intercept calls to reflective class factories (e.g. Class.forName()) when the parameter is a string constant
  • Field Details

    • forNameAtom

      public static final Atom forNameAtom
    • FOR_NAME_REF

      public static final MethodReference FOR_NAME_REF
    • loadClassAtom

      public static final Atom loadClassAtom
    • LOAD_CLASS_REF

      public static final MethodReference LOAD_CLASS_REF
  • Constructor Details

    • ClassFactoryContextSelector

      public ClassFactoryContextSelector()
  • Method Details

    • isClassFactory

      public static boolean isClassFactory(MethodReference m)
    • getUseOfStringParameter

      public int getUseOfStringParameter(SSAAbstractInvokeInstruction call)
    • getCalleeTarget

      public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] receiver)
      If the CallSiteReference invokes Class.forName(s) and s is a string constant, return a JavaTypeContext representing the type named by s, if we can resolve it in the IClassHierarchy.
      Specified by:
      getCalleeTarget in interface ContextSelector
      Parameters:
      caller - the node containing the call site
      site - description of the call site
      receiver - the abstract objects (InstanceKeys) of parameters of interest to the selector
      Returns:
      the Context in which the callee should be evaluated, or null if no information is available.
    • getRelevantParameters

      public IntSet getRelevantParameters(CGNode caller, CallSiteReference site)
      Description copied from interface: ContextSelector
      Given a calling node and a call site, return the set of parameters based on which this selector may choose to specialize contexts.
      Specified by:
      getRelevantParameters in interface ContextSelector
      Parameters:
      caller - the calling node
      site - the specific call site
      Returns:
      the set of parameters of interest