public class SootMethod extends AbstractHost implements ClassMember, Numberable, MethodOrMethodContext
Modifier and Type | Field and Description |
---|---|
protected Body |
activeBody
Active body associated with this method.
|
static java.lang.String |
constructorName |
static boolean |
DEBUG |
protected SootClass |
declaringClass
Holds the class which declares this
SootClass method. |
protected java.util.List<SootClass> |
exceptions
Declared exceptions thrown by this method.
|
protected boolean |
isDeclared
True when some
SootClass object declares this
SootMethod object. |
protected boolean |
isPhantom
Is this method a phantom method?
|
protected int |
modifiers
Modifiers associated with this SootMethod (e.g.
|
protected MethodSource |
ms
Tells this method how to find out where its body lives.
|
protected java.lang.String |
name
Name of the current method.
|
protected int |
number |
protected Type[] |
parameterTypes
An array of parameter types taken by this
SootMethod object,
in declaration order. |
protected Type |
returnType
The return type of this object.
|
static java.lang.String |
staticInitializerName |
protected NumberedString |
subsignature |
col, line, mTagList
Constructor and Description |
---|
SootMethod(java.lang.String name,
java.util.List<Type> parameterTypes,
Type returnType)
Constructs a SootMethod with the given name, parameter types and return
type.
|
SootMethod(java.lang.String name,
java.util.List<Type> parameterTypes,
Type returnType,
int modifiers)
Constructs a SootMethod with the given name, parameter types, return type
and modifiers.
|
SootMethod(java.lang.String name,
java.util.List<Type> parameterTypes,
Type returnType,
int modifiers,
java.util.List<SootClass> thrownExceptions)
Constructs a SootMethod with the given name, parameter types, return
type, and list of thrown exceptions.
|
Modifier and Type | Method and Description |
---|---|
void |
addException(SootClass e)
Adds the given exception to the list of exceptions thrown by this method.
|
void |
addExceptionIfAbsent(SootClass e)
Adds the given exception to the list of exceptions thrown by this method
unless the exception is already in the list.
|
Context |
context() |
int |
equivHashCode()
Returns a hash code for this method consistent with structural equality.
|
Body |
getActiveBody()
Retrieves the active body for this method.
|
java.lang.String |
getBytecodeParms()
Returns the parameters part of the signature in the format in which it
appears in bytecode.
|
java.lang.String |
getBytecodeSignature()
Returns the signature of this method in the format in which it appears in
bytecode (eg.
|
java.lang.String |
getDavaDeclaration() |
java.lang.String |
getDeclaration()
Returns the declaration of this method, as used at the top of textual
body representations (before the {}'s containing the code for
representation.)
|
SootClass |
getDeclaringClass()
Returns the class which declares the current
SootMethod . |
java.util.List<SootClass> |
getExceptions()
Returns a backed list of the exceptions thrown by this method.
|
java.util.List<SootClass> |
getExceptionsUnsafe() |
int |
getJavaSourceStartLineNumber()
Returns the Java source line number if available.
|
int |
getModifiers()
Gets the modifiers of this method.
|
java.lang.String |
getName()
Returns the name of this method.
|
int |
getNumber() |
NumberedString |
getNumberedSubSignature() |
int |
getParameterCount()
Returns the number of parameters taken by this method.
|
Type |
getParameterType(int n)
Gets the type of the nth parameter of this method.
|
java.util.List<Type> |
getParameterTypes()
Returns a read-only list of the parameter types of this method.
|
Type |
getReturnType()
Returns the return type of this method.
|
java.lang.String |
getSignature()
Returns the Soot signature of this method.
|
static java.lang.String |
getSignature(SootClass cl,
java.lang.String name,
java.util.List<Type> params,
Type returnType) |
MethodSource |
getSource()
Returns the MethodSource of the current SootMethod.
|
java.lang.String |
getSubSignature()
Returns the Soot subsignature of this method.
|
static java.lang.String |
getSubSignature(java.lang.String name,
java.util.List<Type> params,
Type returnType) |
boolean |
hasActiveBody()
Returns true if this method has an active body.
|
boolean |
isAbstract()
Convenience method returning true if this method is abstract.
|
boolean |
isConcrete()
Returns true if this method is not phantom, abstract or native, i.e.
|
boolean |
isConstructor() |
boolean |
isDeclared()
Returns true when some
SootClass object declares this
SootMethod object. |
boolean |
isEntryMethod() |
boolean |
isFinal()
Convenience method returning true if this method is final.
|
boolean |
isJavaLibraryMethod()
We rely on the JDK class recognition to decide if a method is JDK method.
|
boolean |
isMain() |
boolean |
isNative()
Convenience method returning true if this method is native.
|
boolean |
isPhantom()
Returns true when this
SootMethod object is phantom. |
boolean |
isPrivate()
Convenience method returning true if this method is private.
|
boolean |
isProtected()
Convenience method returning true if this method is protected.
|
boolean |
isPublic()
Convenience method returning true if this method is public.
|
boolean |
isStatic()
Convenience method returning true if this method is static.
|
boolean |
isStaticInitializer() |
boolean |
isSynchronized()
Convenience method returning true if this method is synchronized.
|
SootMethodRef |
makeRef() |
SootMethod |
method() |
void |
releaseActiveBody()
Releases the active body associated with this method.
|
void |
removeException(SootClass e)
Removes the given exception from the list of exceptions thrown by this
method.
|
Body |
retrieveActiveBody()
Returns the active body if present, else constructs an active body and
returns that.
|
void |
setActiveBody(Body body)
Sets the active body for this method.
|
void |
setDeclared(boolean isDeclared) |
void |
setDeclaringClass(SootClass declClass)
Nomair A.
|
void |
setExceptions(java.util.List<SootClass> exceptions) |
void |
setModifiers(int modifiers)
Sets the modifiers of this method.
|
void |
setName(java.lang.String name)
Sets the name of this method.
|
void |
setNumber(int number) |
void |
setParameterTypes(java.util.List<Type> l)
Changes the set of parameter types of this method.
|
void |
setPhantom(boolean value)
Sets the phantom flag on this method.
|
void |
setReturnType(Type t)
Sets the return type of this method.
|
void |
setSource(MethodSource ms)
Sets the MethodSource of the current SootMethod.
|
boolean |
throwsException(SootClass e)
Returns true if this method throws exception
e . |
java.lang.String |
toString()
Returns the signature of this method.
|
addAllTagsOf, addTag, getJavaSourceStartColumnNumber, getTag, getTags, hasTag, removeAllTags, removeTag
public static final java.lang.String constructorName
public static final java.lang.String staticInitializerName
public static boolean DEBUG
protected java.lang.String name
protected Type[] parameterTypes
SootMethod
object,
in declaration order.protected Type returnType
protected boolean isDeclared
SootClass
object declares this
SootMethod
object.protected SootClass declaringClass
SootClass
method.protected int modifiers
protected boolean isPhantom
protected java.util.List<SootClass> exceptions
protected volatile Body activeBody
protected volatile MethodSource ms
protected NumberedString subsignature
protected int number
public SootMethod(java.lang.String name, java.util.List<Type> parameterTypes, Type returnType)
public SootMethod(java.lang.String name, java.util.List<Type> parameterTypes, Type returnType, int modifiers)
public void setSource(MethodSource ms)
public MethodSource getSource()
public int equivHashCode()
public java.lang.String getName()
public void setDeclaringClass(SootClass declClass)
public SootClass getDeclaringClass()
SootMethod
.getDeclaringClass
in interface ClassMember
public void setDeclared(boolean isDeclared)
public boolean isDeclared()
SootClass
object declares this
SootMethod
object.isDeclared
in interface ClassMember
public boolean isPhantom()
SootMethod
object is phantom.isPhantom
in interface ClassMember
public boolean isConcrete()
public void setPhantom(boolean value)
setPhantom
in interface ClassMember
public void setName(java.lang.String name)
public int getModifiers()
getModifiers
in interface ClassMember
Modifier
public void setModifiers(int modifiers)
setModifiers
in interface ClassMember
Modifier
public Type getReturnType()
public void setReturnType(Type t)
public int getParameterCount()
public Type getParameterType(int n)
public java.util.List<Type> getParameterTypes()
public void setParameterTypes(java.util.List<Type> l)
public Body getActiveBody()
public Body retrieveActiveBody()
public void setActiveBody(Body body)
public boolean hasActiveBody()
public void releaseActiveBody()
public void addExceptionIfAbsent(SootClass e)
public void addException(SootClass e)
public void removeException(SootClass e)
public boolean throwsException(SootClass e)
e
.public void setExceptions(java.util.List<SootClass> exceptions)
public java.util.List<SootClass> getExceptions()
public java.util.List<SootClass> getExceptionsUnsafe()
public boolean isStatic()
isStatic
in interface ClassMember
public boolean isPrivate()
isPrivate
in interface ClassMember
public boolean isPublic()
isPublic
in interface ClassMember
public boolean isProtected()
isProtected
in interface ClassMember
public boolean isAbstract()
public boolean isFinal()
public boolean isNative()
public boolean isSynchronized()
public boolean isMain()
public boolean isConstructor()
public boolean isStaticInitializer()
public boolean isEntryMethod()
public boolean isJavaLibraryMethod()
public java.lang.String getBytecodeParms()
public java.lang.String getBytecodeSignature()
public java.lang.String getSignature()
public static java.lang.String getSignature(SootClass cl, java.lang.String name, java.util.List<Type> params, Type returnType)
public java.lang.String getSubSignature()
public static java.lang.String getSubSignature(java.lang.String name, java.util.List<Type> params, Type returnType)
public NumberedString getNumberedSubSignature()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getDavaDeclaration()
public java.lang.String getDeclaration()
public final int getNumber()
getNumber
in interface Numberable
public final void setNumber(int number)
setNumber
in interface Numberable
public SootMethod method()
method
in interface MethodOrMethodContext
public Context context()
context
in interface MethodOrMethodContext
public SootMethodRef makeRef()
public int getJavaSourceStartLineNumber()
Host
getJavaSourceStartLineNumber
in interface Host
getJavaSourceStartLineNumber
in class AbstractHost