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 com.ibm.wala.ipa.callgraph.ContextItem
ContextItem.Value<T>
Nested classes/interfaces inherited from interface com.ibm.wala.classLoader.IMethod
IMethod.SourcePosition
-
Field Summary
Modifier and TypeFieldDescriptionprotected InstructionArray
protected final DexIClass
The declaring class for this method. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
int
getAddressFromIndex
(int index) Get the annotations on this member, if anygetAnnotations
(boolean runtimeInvisible) int
getBytecodeIndex
(int i) thereReturn the object that represents the declaring class for this member.something like: (IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;int
ExceptionHandler[][]
getInstructionFromIndex
(int instructionIndex) int
getInstructionIndex
(int bytecodeindex) int
getLineNumber
(int bcIndex) getLocalVariableName
(int bcIndex, int localNumber) int
XXX not fully about the + 2.int
getName()
int
int
Method getNumberOfParameters.getParameterSourcePosition
(int paramNum) getParameterType
(int index) By convention, for a non-static method, getParameterType(0) is the this pointerint
something 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 int
protected void
handleINVOKE_VIRTUAL
(int instLoc, String cname, String mname, String pname, int[] args, org.jf.dexlib2.Opcode opcode) boolean
int
hashCode()
boolean
protected InstructionArray
boolean
Is this method abstract?boolean
boolean
isBridge()
Is this method a bridge method? See JLS 3rd Edition 15.12.4.5boolean
isClinit()
Is this method a class initializer?boolean
isEnum()
boolean
isFinal()
Is this method final?boolean
isInit()
Is this method an object initializer?boolean
isModule()
boolean
isNative()
Is this method native?boolean
Is this method private?boolean
Is this method protected?boolean
isPublic()
Is this method public?boolean
isStatic()
Is this member static?boolean
Is this method synchronized?boolean
Is this method synthetic, i.e., compiler-generated (this refers to the synthetic flag in java/dex bytecode)boolean
boolean
Is the implementation of this method a model generated by WALA? For compiler-generated synthetic methods, refer toIMethod.isSynthetic()
protected void
org.jf.dexlib2.iface.Method
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.ibm.wala.classLoader.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:
getDeclaredExceptions
in 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:
getLocalVariableName
in 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:IMethod
something like: (IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;- Specified by:
getDescriptor
in interfaceIMethod
-
getNumberOfParameters
public int getNumberOfParameters()Description copied from interface:IMethod
Method getNumberOfParameters. This result includes the "this" pointer if applicable- Specified by:
getNumberOfParameters
in interfaceIMethod
-
getNumberOfParameterRegisters
public int getNumberOfParameterRegisters() -
getParameterType
Description copied from interface:IMethod
By convention, for a non-static method, getParameterType(0) is the this pointer- Specified by:
getParameterType
in interfaceIMethod
-
getReference
- Specified by:
getReference
in interfaceIMethod
- Returns:
- canonical MethodReference corresponding to this method
-
getReturnType
- Specified by:
getReturnType
in interfaceIMethod
- Returns:
- the name of the return type for this method
-
getSelector
Description copied from interface:IMethod
something like: foo(Ljava/langString;)Ljava/lang/Class;- Specified by:
getSelector
in interfaceIMethod
-
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 interfaceIMethod
-
hasExceptionHandler
public boolean hasExceptionHandler()- Specified by:
hasExceptionHandler
in interfaceIMethod
- Returns:
- true iff this method has at least one exception handler
-
hasLocalVariableTable
public boolean hasLocalVariableTable()- Specified by:
hasLocalVariableTable
in interfaceIMethod
- Returns:
- true iff the local variable table information for this method is available
-
isAbstract
public boolean isAbstract()Description copied from interface:IMethod
Is this method abstract?- Specified by:
isAbstract
in interfaceIMethod
-
isClinit
-
isFinal
-
isInit
-
isNative
-
isBridge
-
isPrivate
-
isProtected
public boolean isProtected()Description copied from interface:IMethod
Is this method protected?- Specified by:
isProtected
in interfaceIMethod
-
isPublic
-
isSynchronized
public boolean isSynchronized()Description copied from interface:IMethod
Is this method synchronized?- Specified by:
isSynchronized
in interfaceIMethod
-
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 toIMethod.isSynthetic()
- Specified by:
isWalaSynthetic
in interfaceIMethod
-
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 interfaceIMethod
-
isStatic
-
isVolatile
public boolean isVolatile() -
isAnnotation
public boolean isAnnotation()- Specified by:
isAnnotation
in interfaceIMethod
-
isEnum
-
isModule
-
getDeclaringClass
Description copied from interface:IMember
Return the object that represents the declaring class for this member.- Specified by:
getDeclaringClass
in interfaceIMember
- Returns:
- the object that represents the declaring class for this member.
-
getClassHierarchy
- Specified by:
getClassHierarchy
in interfaceIClassHierarchyDweller
-
getName
-
getLineNumber
public int getLineNumber(int bcIndex) - Specified by:
getLineNumber
in 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:
getBytecodeIndex
in interfaceIBytecodeMethod<Instruction>
- Returns:
- the bytecode index corresponding to instruction i in the getInstructions() array
-
getHandlers
- Specified by:
getHandlers
in interfaceIBytecodeMethod<Instruction>
- Returns:
- the Shrike representation of the exception handlers
-
getInstructions
- Specified by:
getInstructions
in 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:
getInstructionIndex
in interfaceIBytecodeMethod<Instruction>
- Returns:
- the instuction index i in the getInstructions() array corresponding to the bytecode index bcIndex
-
getInstructionFromIndex
-
getIndirectionData
- Specified by:
getIndirectionData
in interfaceIBytecodeMethod<Instruction>
- Returns:
- information about any indirect uses of local variables
-
getCallSites
Description copied from interface:IBytecodeMethod
there- Specified by:
getCallSites
in 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:
getFieldsRead
in interfaceIBytecodeMethod<Instruction>
-
getFieldsWritten
- Specified by:
getFieldsWritten
in interfaceIBytecodeMethod<Instruction>
-
getArraysWritten
- Specified by:
getArraysWritten
in interfaceIBytecodeMethod<Instruction>
-
getNewSites
- Specified by:
getNewSites
in interfaceIBytecodeMethod<Instruction>
- Returns:
- the new sites declared in the bytecode for this method
-
getSourcePosition
- Specified by:
getSourcePosition
in interfaceIMethod
-
getParameterSourcePosition
- Specified by:
getParameterSourcePosition
in interfaceIMethod
-
getAnnotations
Description copied from interface:IMember
Get the annotations on this member, if any- Specified by:
getAnnotations
in interfaceIMember
-
getAnnotations
- Specified by:
getAnnotations
in interfaceIBytecodeMethod<Instruction>
-
getParameterAnnotations
- Specified by:
getParameterAnnotations
in interfaceIBytecodeMethod<Instruction>
-