Class DexIMethod

java.lang.Object
com.ibm.wala.dalvik.classLoader.DexIMethod
All Implemented Interfaces:
com.ibm.wala.classLoader.IBytecodeMethod<Instruction>, com.ibm.wala.classLoader.IMember, com.ibm.wala.classLoader.IMethod, com.ibm.wala.ipa.callgraph.ContextItem, com.ibm.wala.ipa.cha.IClassHierarchyDweller

public class DexIMethod extends Object implements com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
A wrapper around a EncodedMethod object (from dexlib) that represents a method.
  • Field Details

    • myClass

      protected final DexIClass myClass
      The declaring class for this method.
    • instructions

      protected InstructionArray instructions
  • Constructor Details

    • DexIMethod

      public DexIMethod(org.jf.dexlib2.iface.Method encodedMethod, DexIClass klass)
  • Method Details

    • getTotalInsts

      public static int getTotalInsts()
    • toEncodedMethod

      public org.jf.dexlib2.iface.Method toEncodedMethod()
      Returns:
      the EncodedMethod object for which this DexIMethod is a wrapper.
    • getDeclaredExceptions

      public com.ibm.wala.types.TypeReference[] getDeclaredExceptions() throws UnsupportedOperationException
      Specified by:
      getDeclaredExceptions in interface com.ibm.wala.classLoader.IMethod
      Throws:
      UnsupportedOperationException
    • getLocalVariableName

      public String getLocalVariableName(int bcIndex, int localNumber)
      Specified by:
      getLocalVariableName in interface com.ibm.wala.classLoader.IMethod
    • getMaxLocals

      public int getMaxLocals()
      XXX not fully about the + 2.
      Returns:
      the RegisterCount + 2 to make some room for the return and exception register
      See Also:
      • ShrikeCTMethod.getMaxLocals()
    • getReturnReg

      public int getReturnReg()
    • getExceptionReg

      public int getExceptionReg()
    • getMaxStackHeight

      public int getMaxStackHeight()
    • getDescriptor

      public com.ibm.wala.types.Descriptor getDescriptor()
      Specified by:
      getDescriptor in interface com.ibm.wala.classLoader.IMethod
    • getNumberOfParameters

      public int getNumberOfParameters()
      Specified by:
      getNumberOfParameters in interface com.ibm.wala.classLoader.IMethod
    • getNumberOfParameterRegisters

      public int getNumberOfParameterRegisters()
    • getParameterType

      public com.ibm.wala.types.TypeReference getParameterType(int index)
      Specified by:
      getParameterType in interface com.ibm.wala.classLoader.IMethod
    • getReference

      public com.ibm.wala.types.MethodReference getReference()
      Specified by:
      getReference in interface com.ibm.wala.classLoader.IMethod
    • getReturnType

      public com.ibm.wala.types.TypeReference getReturnType()
      Specified by:
      getReturnType in interface com.ibm.wala.classLoader.IMethod
    • getSelector

      public com.ibm.wala.types.Selector getSelector()
      Specified by:
      getSelector in interface com.ibm.wala.classLoader.IMethod
    • getSignature

      public String getSignature()
      Specified by:
      getSignature in interface com.ibm.wala.classLoader.IMethod
    • hasExceptionHandler

      public boolean hasExceptionHandler()
      Specified by:
      hasExceptionHandler in interface com.ibm.wala.classLoader.IMethod
    • hasLocalVariableTable

      public boolean hasLocalVariableTable()
      Specified by:
      hasLocalVariableTable in interface com.ibm.wala.classLoader.IMethod
    • isAbstract

      public boolean isAbstract()
      Specified by:
      isAbstract in interface com.ibm.wala.classLoader.IMethod
    • isClinit

      public boolean isClinit()
      Specified by:
      isClinit in interface com.ibm.wala.classLoader.IMethod
    • isFinal

      public boolean isFinal()
      Specified by:
      isFinal in interface com.ibm.wala.classLoader.IMethod
    • isInit

      public boolean isInit()
      Specified by:
      isInit in interface com.ibm.wala.classLoader.IMethod
    • isNative

      public boolean isNative()
      Specified by:
      isNative in interface com.ibm.wala.classLoader.IMethod
    • isBridge

      public boolean isBridge()
      Specified by:
      isBridge in interface com.ibm.wala.classLoader.IMethod
    • isPrivate

      public boolean isPrivate()
      Specified by:
      isPrivate in interface com.ibm.wala.classLoader.IMethod
    • isProtected

      public boolean isProtected()
      Specified by:
      isProtected in interface com.ibm.wala.classLoader.IMethod
    • isPublic

      public boolean isPublic()
      Specified by:
      isPublic in interface com.ibm.wala.classLoader.IMethod
    • isSynchronized

      public boolean isSynchronized()
      Specified by:
      isSynchronized in interface com.ibm.wala.classLoader.IMethod
    • isWalaSynthetic

      public boolean isWalaSynthetic()
      Specified by:
      isWalaSynthetic in interface com.ibm.wala.classLoader.IMethod
    • isSynthetic

      public boolean isSynthetic()
      Specified by:
      isSynthetic in interface com.ibm.wala.classLoader.IMethod
    • isStatic

      public boolean isStatic()
      Specified by:
      isStatic in interface com.ibm.wala.classLoader.IMember
    • isVolatile

      public boolean isVolatile()
    • isAnnotation

      public boolean isAnnotation()
      Specified by:
      isAnnotation in interface com.ibm.wala.classLoader.IMethod
    • isEnum

      public boolean isEnum()
      Specified by:
      isEnum in interface com.ibm.wala.classLoader.IMethod
    • isModule

      public boolean isModule()
      Specified by:
      isModule in interface com.ibm.wala.classLoader.IMethod
    • getDeclaringClass

      public com.ibm.wala.classLoader.IClass getDeclaringClass()
      Specified by:
      getDeclaringClass in interface com.ibm.wala.classLoader.IMember
    • getClassHierarchy

      public com.ibm.wala.ipa.cha.IClassHierarchy getClassHierarchy()
      Specified by:
      getClassHierarchy in interface com.ibm.wala.ipa.cha.IClassHierarchyDweller
    • getName

      public com.ibm.wala.core.util.strings.Atom getName()
      Specified by:
      getName in interface com.ibm.wala.classLoader.IMember
    • getLineNumber

      public int getLineNumber(int bcIndex)
      Specified by:
      getLineNumber in interface com.ibm.wala.classLoader.IMethod
    • toString

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

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

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

      public int getBytecodeIndex(int i)
      Specified by:
      getBytecodeIndex in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • getHandlers

      public com.ibm.wala.shrike.shrikeBT.ExceptionHandler[][] getHandlers()
      Specified by:
      getHandlers in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • getInstructions

      public Instruction[] getInstructions()
      Specified by:
      getInstructions in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • parseBytecode

      protected void parseBytecode()
    • handleINVOKE_VIRTUAL

      protected void handleINVOKE_VIRTUAL(int instLoc, String cname, String mname, String pname, int[] args, org.jf.dexlib2.Opcode opcode)
    • getDexInstructions

      public Instruction[] getDexInstructions()
    • instructions

      protected InstructionArray instructions()
    • getAddressFromIndex

      public int getAddressFromIndex(int index)
    • getInstructionIndex

      public int getInstructionIndex(int bytecodeindex)
      Specified by:
      getInstructionIndex in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • getInstructionFromIndex

      public Instruction getInstructionFromIndex(int instructionIndex)
    • getIndirectionData

      public com.ibm.wala.shrike.shrikeBT.IndirectionData getIndirectionData()
      Specified by:
      getIndirectionData in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • getCallSites

      public Collection<com.ibm.wala.classLoader.CallSiteReference> getCallSites()
      Specified by:
      getCallSites in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
      Throws:
      UnsupportedOperationException -

      TODO: Review this implementation - it may be horribly wrong!

    • getFieldsRead

      public Iterator<com.ibm.wala.types.FieldReference> getFieldsRead()
      Specified by:
      getFieldsRead in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • getFieldsWritten

      public Iterator<com.ibm.wala.types.FieldReference> getFieldsWritten()
      Specified by:
      getFieldsWritten in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • getArraysWritten

      public Iterator<com.ibm.wala.types.TypeReference> getArraysWritten()
      Specified by:
      getArraysWritten in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • getNewSites

      public Collection<com.ibm.wala.classLoader.NewSiteReference> getNewSites()
      Specified by:
      getNewSites in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • getSourcePosition

      public com.ibm.wala.classLoader.IMethod.SourcePosition getSourcePosition(int instructionIndex)
      Specified by:
      getSourcePosition in interface com.ibm.wala.classLoader.IMethod
    • getParameterSourcePosition

      public com.ibm.wala.classLoader.IMethod.SourcePosition getParameterSourcePosition(int paramNum)
      Specified by:
      getParameterSourcePosition in interface com.ibm.wala.classLoader.IMethod
    • getAnnotations

      public Collection<com.ibm.wala.types.annotations.Annotation> getAnnotations()
      Specified by:
      getAnnotations in interface com.ibm.wala.classLoader.IMember
    • getAnnotations

      public Collection<com.ibm.wala.types.annotations.Annotation> getAnnotations(boolean runtimeInvisible)
      Specified by:
      getAnnotations in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>
    • getParameterAnnotations

      public Collection<com.ibm.wala.types.annotations.Annotation>[] getParameterAnnotations()
      Specified by:
      getParameterAnnotations in interface com.ibm.wala.classLoader.IBytecodeMethod<Instruction>