Class SyntheticMethod

java.lang.Object
com.ibm.wala.classLoader.SyntheticMethod
All Implemented Interfaces:
IMember, IMethod, ContextItem, IClassHierarchyDweller
Direct Known Subclasses:
AbstractReflectionInterpreter.SpecializedMethod, AbstractRootMethod, SummarizedMethod

public class SyntheticMethod extends Object implements IMethod
An implementation of IMethod, usually for a synthesized method that is not read directly from any source Module.
  • Field Details

    • NO_STATEMENTS

      public static final SSAInstruction[] NO_STATEMENTS
    • resolvedMethod

      protected final IMethod resolvedMethod
    • declaringClass

      public final IClass declaringClass
  • Constructor Details

    • SyntheticMethod

      public SyntheticMethod(MethodReference method, IClass declaringClass, boolean isStatic, boolean isFactory)
    • SyntheticMethod

      public SyntheticMethod(IMethod method, IClass declaringClass, boolean isStatic, boolean isFactory)
  • Method Details

    • isClinit

      public boolean isClinit()
      Description copied from interface: IMethod
      Is this method a class initializer?
      Specified by:
      isClinit in interface IMethod
    • isInit

      public boolean isInit()
      Description copied from interface: IMethod
      Is this method an object initializer?
      Specified by:
      isInit in interface IMethod
    • isStatic

      public boolean isStatic()
      Description copied from interface: IMember
      Is this member static?
      Specified by:
      isStatic in interface IMember
    • isNative

      public boolean isNative()
      Description copied from interface: IMethod
      Is this method native?
      Specified by:
      isNative in interface IMethod
    • isAbstract

      public boolean isAbstract()
      Description copied from interface: IMethod
      Is this method abstract?
      Specified by:
      isAbstract in interface IMethod
    • isPrivate

      public boolean isPrivate()
      Description copied from interface: IMethod
      Is this method private?
      Specified by:
      isPrivate in interface IMethod
    • isProtected

      public boolean isProtected()
      Description copied from interface: IMethod
      Is this method protected?
      Specified by:
      isProtected in interface IMethod
    • isPublic

      public boolean isPublic()
      Description copied from interface: IMethod
      Is this method public?
      Specified by:
      isPublic in interface IMethod
    • isFinal

      public boolean isFinal()
      Description copied from interface: IMethod
      Is this method final?
      Specified by:
      isFinal in interface IMethod
    • isBridge

      public boolean isBridge()
      Description copied from interface: IMethod
      Is this method a bridge method? See JLS 3rd Edition 15.12.4.5
      Specified by:
      isBridge in interface IMethod
    • isSynchronized

      public boolean isSynchronized()
      Description copied from interface: IMethod
      Is this method synchronized?
      Specified by:
      isSynchronized in interface IMethod
      See Also:
    • isAnnotation

      public boolean isAnnotation()
      Specified by:
      isAnnotation in interface IMethod
    • isEnum

      public boolean isEnum()
      Specified by:
      isEnum in interface IMethod
    • isModule

      public boolean isModule()
      Specified by:
      isModule in interface IMethod
    • isWalaSynthetic

      public boolean isWalaSynthetic()
      Description copied from interface: IMethod
      Is the implementation of this method a model generated by WALA? For compiler-generated synthetic methods, refer to IMethod.isSynthetic()
      Specified by:
      isWalaSynthetic in interface IMethod
    • isSynthetic

      public boolean isSynthetic()
      Description copied from interface: IMethod
      Is this method synthetic, i.e., compiler-generated (this refers to the synthetic flag in java/dex bytecode)
      Specified by:
      isSynthetic in interface IMethod
    • getReference

      public MethodReference getReference()
      Specified by:
      getReference in interface IMethod
      Returns:
      canonical MethodReference corresponding to this method
    • makeControlFlowGraph

      public InducedCFG makeControlFlowGraph(SSAInstruction[] instructions)
      Create an InducedCFG from an instruction array.

      NOTE: SIDE EFFECT!!! ... nulls out phi instructions in the instruction array!

    • getBytecodeStream

      public BytecodeStream getBytecodeStream() throws UnsupportedOperationException
      Throws:
      UnsupportedOperationException
    • getMaxLocals

      public int getMaxLocals() throws UnsupportedOperationException
      TODO: why isn't this abstract?
      Throws:
      UnsupportedOperationException - unconditionally
    • getMaxStackHeight

      public int getMaxStackHeight() throws UnsupportedOperationException
      TODO: why isn't this abstract?
      Throws:
      UnsupportedOperationException
    • getDeclaringClass

      public IClass getDeclaringClass()
      Description copied from interface: IMember
      Return the object that represents the declaring class for this member.
      Specified by:
      getDeclaringClass in interface IMember
      Returns:
      the object that represents the declaring class for this member.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hasExceptionHandler

      public boolean hasExceptionHandler()
      Specified by:
      hasExceptionHandler in interface IMethod
      Returns:
      true iff this method has at least one exception handler
    • hasPoison

      public boolean hasPoison()
    • getPoison

      public String getPoison()
    • getPoisonLevel

      public byte getPoisonLevel()
    • makeIR

      public IR makeIR(Context context, SSAOptions options) throws UnimplementedError
      Most subclasses should override this.
      Parameters:
      context - TODO
      options - options governing IR conversion
      Throws:
      UnimplementedError
    • getParameterType

      public TypeReference getParameterType(int i)
      Description copied from interface: IMethod
      By convention, for a non-static method, getParameterType(0) is the this pointer
      Specified by:
      getParameterType in interface IMethod
    • getNumberOfParameters

      public int getNumberOfParameters()
      Description copied from interface: IMethod
      Method getNumberOfParameters. This result includes the "this" pointer if applicable
      Specified by:
      getNumberOfParameters in interface IMethod
    • getDeclaredExceptions

      public TypeReference[] getDeclaredExceptions() throws InvalidClassFileException
      Specified by:
      getDeclaredExceptions in interface IMethod
      Returns:
      an array of the exception types declared by the throws clause for this method, or null if there are none
      Throws:
      InvalidClassFileException
    • getName

      public Atom getName()
      Specified by:
      getName in interface IMember
      Returns:
      the name of this member
    • getDescriptor

      public Descriptor getDescriptor()
      Description copied from interface: IMethod
      something like: (IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;
      Specified by:
      getDescriptor in interface IMethod
    • getSourcePosition

      public IMethod.SourcePosition getSourcePosition(int bcIndex) throws InvalidClassFileException
      Specified by:
      getSourcePosition in interface IMethod
      Throws:
      InvalidClassFileException
    • getParameterSourcePosition

      public IMethod.SourcePosition getParameterSourcePosition(int paramNum) throws InvalidClassFileException
      Specified by:
      getParameterSourcePosition in interface IMethod
      Throws:
      InvalidClassFileException
    • getLineNumber

      public int getLineNumber(int bcIndex)
      Specified by:
      getLineNumber in interface IMethod
      Returns:
      the source line number corresponding to a particular bytecode index, or -1 if the information is not available.
    • isFactoryMethod

      public boolean isFactoryMethod()
    • getSignature

      public String getSignature()
      Description copied from interface: IMethod
      something like: com.foo.bar.createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;
      Specified by:
      getSignature in interface IMethod
    • getSelector

      public Selector getSelector()
      Description copied from interface: IMethod
      something like: foo(Ljava/langString;)Ljava/lang/Class;
      Specified by:
      getSelector in interface IMethod
    • getLocalVariableName

      public String getLocalVariableName(int bcIndex, int localNumber)
      Specified by:
      getLocalVariableName in interface IMethod
      Returns:
      the (source code) name of the local variable of a given number at the specified program counter, or null if the information is not available.
    • hasLocalVariableTable

      public boolean hasLocalVariableTable()
      Specified by:
      hasLocalVariableTable in interface IMethod
      Returns:
      true iff the local variable table information for this method is available
    • getStatements

      public SSAInstruction[] getStatements()
    • getReturnType

      public TypeReference getReturnType()
      Specified by:
      getReturnType in interface IMethod
      Returns:
      the name of the return type for this method
    • getClassHierarchy

      public IClassHierarchy getClassHierarchy()
      Specified by:
      getClassHierarchy in interface IClassHierarchyDweller
    • getAnnotations

      public Collection<Annotation> getAnnotations()
      Description copied from interface: IMember
      Get the annotations on this member, if any
      Specified by:
      getAnnotations in interface IMember