Class DexIMethod
java.lang.Object
com.ibm.wala.dalvik.classLoader.DexIMethod
- All Implemented Interfaces:
IBytecodeMethod<Instruction>, IMember, IMethod, ContextItem, IClassHierarchyDweller
A wrapper around a EncodedMethod object (from dexlib) that represents a method.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ContextItem
ContextItem.Value<T>Nested classes/interfaces inherited from interface IMethod
IMethod.SourcePosition -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InstructionArrayprotected final DexIClassThe declaring class for this method. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintgetAddressFromIndex(int index) Get the annotations on this member, if anygetAnnotations(boolean runtimeInvisible) intgetBytecodeIndex(int i) thereReturn the object that represents the declaring class for this member.something like: (IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;intExceptionHandler[][]getInstructionFromIndex(int instructionIndex) intgetInstructionIndex(int bytecodeindex) intgetLineNumber(int bcIndex) getLocalVariableName(int bcIndex, int localNumber) intXXX not fully about the + 2.intgetName()intintMethod getNumberOfParameters.getParameterSourcePosition(int paramNum) getParameterType(int index) By convention, for a non-static method, getParameterType(0) is the this pointerintsomething like: foo(Ljava/langString;)Ljava/lang/Class;something like: com.foo.bar.createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;getSourcePosition(int instructionIndex) static intprotected voidhandleINVOKE_VIRTUAL(int instLoc, String cname, String mname, String pname, int[] args, org.jf.dexlib2.Opcode opcode) booleaninthashCode()booleanprotected InstructionArraybooleanIs this method abstract?booleanbooleanisBridge()Is this method a bridge method? See JLS 3rd Edition 15.12.4.5booleanisClinit()Is this method a class initializer?booleanisEnum()booleanisFinal()Is this method final?booleanisInit()Is this method an object initializer?booleanisModule()booleanisNative()Is this method native?booleanIs this method private?booleanIs this method protected?booleanisPublic()Is this method public?booleanisStatic()Is this member static?booleanIs this method synchronized?booleanIs this method synthetic, i.e., compiler-generated (this refers to the synthetic flag in java/dex bytecode)booleanbooleanIs the implementation of this method a model generated by WALA? For compiler-generated synthetic methods, refer toIMethod.isSynthetic()protected voidorg.jf.dexlib2.iface.MethodtoString()Methods inherited from interface IMethod
getNumberOfDefaultParameters
-
Field Details
-
myClass
The declaring class for this method. -
instructions
-
-
Constructor Details
-
DexIMethod
-
-
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
- Specified by:
getDeclaredExceptionsin interfaceIMethod- Returns:
- an array of the exception types declared by the throws clause for this method, or null if there are none
- Throws:
UnsupportedOperationException
-
getLocalVariableName
- Specified by:
getLocalVariableNamein interfaceIMethod- 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.
-
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:
-
getReturnReg
public int getReturnReg() -
getExceptionReg
public int getExceptionReg() -
getMaxStackHeight
public int getMaxStackHeight() -
getDescriptor
Description copied from interface:IMethodsomething like: (IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;- Specified by:
getDescriptorin interfaceIMethod
-
getNumberOfParameters
public int getNumberOfParameters()Description copied from interface:IMethodMethod getNumberOfParameters. This result includes the "this" pointer if applicable- Specified by:
getNumberOfParametersin interfaceIMethod
-
getNumberOfParameterRegisters
public int getNumberOfParameterRegisters() -
getParameterType
Description copied from interface:IMethodBy convention, for a non-static method, getParameterType(0) is the this pointer- Specified by:
getParameterTypein interfaceIMethod
-
getReference
- Specified by:
getReferencein interfaceIMethod- Returns:
- canonical MethodReference corresponding to this method
-
getReturnType
- Specified by:
getReturnTypein interfaceIMethod- Returns:
- the name of the return type for this method
-
getSelector
Description copied from interface:IMethodsomething like: foo(Ljava/langString;)Ljava/lang/Class;- Specified by:
getSelectorin interfaceIMethod
-
getSignature
Description copied from interface:IMethodsomething like: com.foo.bar.createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;- Specified by:
getSignaturein interfaceIMethod
-
hasExceptionHandler
public boolean hasExceptionHandler()- Specified by:
hasExceptionHandlerin interfaceIMethod- Returns:
- true iff this method has at least one exception handler
-
hasLocalVariableTable
public boolean hasLocalVariableTable()- Specified by:
hasLocalVariableTablein interfaceIMethod- Returns:
- true iff the local variable table information for this method is available
-
isAbstract
public boolean isAbstract()Description copied from interface:IMethodIs this method abstract?- Specified by:
isAbstractin interfaceIMethod
-
isClinit
-
isFinal
-
isInit
-
isNative
-
isBridge
-
isPrivate
-
isProtected
public boolean isProtected()Description copied from interface:IMethodIs this method protected?- Specified by:
isProtectedin interfaceIMethod
-
isPublic
-
isSynchronized
public boolean isSynchronized()Description copied from interface:IMethodIs this method synchronized?- Specified by:
isSynchronizedin interfaceIMethod
-
isWalaSynthetic
public boolean isWalaSynthetic()Description copied from interface:IMethodIs the implementation of this method a model generated by WALA? For compiler-generated synthetic methods, refer toIMethod.isSynthetic()- Specified by:
isWalaSyntheticin interfaceIMethod
-
isSynthetic
public boolean isSynthetic()Description copied from interface:IMethodIs this method synthetic, i.e., compiler-generated (this refers to the synthetic flag in java/dex bytecode)- Specified by:
isSyntheticin interfaceIMethod
-
isStatic
-
isVolatile
public boolean isVolatile() -
isAnnotation
public boolean isAnnotation()- Specified by:
isAnnotationin interfaceIMethod
-
isEnum
-
isModule
-
getDeclaringClass
Description copied from interface:IMemberReturn the object that represents the declaring class for this member.- Specified by:
getDeclaringClassin interfaceIMember- Returns:
- the object that represents the declaring class for this member.
-
getClassHierarchy
- Specified by:
getClassHierarchyin interfaceIClassHierarchyDweller
-
getName
-
getLineNumber
public int getLineNumber(int bcIndex) - Specified by:
getLineNumberin interfaceIMethod- Returns:
- the source line number corresponding to a particular bytecode index, or -1 if the information is not available.
-
toString
-
equals
-
hashCode
-
getBytecodeIndex
public int getBytecodeIndex(int i) - Specified by:
getBytecodeIndexin interfaceIBytecodeMethod<Instruction>- Returns:
- the bytecode index corresponding to instruction i in the getInstructions() array
-
getHandlers
- Specified by:
getHandlersin interfaceIBytecodeMethod<Instruction>- Returns:
- the Shrike representation of the exception handlers
-
getInstructions
- Specified by:
getInstructionsin interfaceIBytecodeMethod<Instruction>- Returns:
- the Shrike instructions decoded from the bytecode
-
parseBytecode
protected void parseBytecode() -
handleINVOKE_VIRTUAL
-
getDexInstructions
-
instructions
-
getAddressFromIndex
public int getAddressFromIndex(int index) -
getInstructionIndex
public int getInstructionIndex(int bytecodeindex) - Specified by:
getInstructionIndexin interfaceIBytecodeMethod<Instruction>- Returns:
- the instruction index i in the getInstructions() array corresponding to the bytecode index bcIndex
-
getInstructionFromIndex
-
getIndirectionData
- Specified by:
getIndirectionDatain interfaceIBytecodeMethod<Instruction>- Returns:
- information about any indirect uses of local variables
-
getCallSites
Description copied from interface:IBytecodeMethodthere- Specified by:
getCallSitesin interfaceIBytecodeMethod<Instruction>- Returns:
- the call sites declared in the bytecode for this method
- Throws:
UnsupportedOperationException-TODO: Review this implementation - it may be horribly wrong!
-
getFieldsRead
- Specified by:
getFieldsReadin interfaceIBytecodeMethod<Instruction>
-
getFieldsWritten
- Specified by:
getFieldsWrittenin interfaceIBytecodeMethod<Instruction>
-
getArraysWritten
- Specified by:
getArraysWrittenin interfaceIBytecodeMethod<Instruction>
-
getNewSites
- Specified by:
getNewSitesin interfaceIBytecodeMethod<Instruction>- Returns:
- the new sites declared in the bytecode for this method
-
getSourcePosition
- Specified by:
getSourcePositionin interfaceIMethod
-
getParameterSourcePosition
- Specified by:
getParameterSourcePositionin interfaceIMethod
-
getAnnotations
Description copied from interface:IMemberGet the annotations on this member, if any- Specified by:
getAnnotationsin interfaceIMember
-
getAnnotations
- Specified by:
getAnnotationsin interfaceIBytecodeMethod<Instruction>
-
getParameterAnnotations
- Specified by:
getParameterAnnotationsin interfaceIBytecodeMethod<Instruction>
-