public class SootClass extends AbstractHost implements Numberable
Modifier and Type | Field and Description |
---|---|
static int |
BODIES |
static int |
DANGLING |
protected Chain<SootField> |
fields |
protected String |
fixedPackageName |
protected String |
fixedShortName |
static int |
HIERARCHY |
protected Chain<SootClass> |
interfaces |
static String |
INVOKEDYNAMIC_DUMMY_CLASS_NAME |
protected boolean |
isInScene |
protected boolean |
isPhantom |
protected List<SootMethod> |
methodList |
protected int |
modifiers |
protected String |
name |
protected SootClass |
outerClass |
protected String |
packageName |
protected String |
shortName |
static int |
SIGNATURES |
protected SmallNumberedMap<SootMethod> |
subSigToMethods |
protected SootClass |
superClass |
col, line
Constructor and Description |
---|
SootClass(String name)
Constructs an empty SootClass with the given name and no modifiers.
|
SootClass(String name,
int modifiers)
Constructs an empty SootClass with the given name and modifiers.
|
Modifier and Type | Method and Description |
---|---|
void |
addField(SootField f)
Adds the given field to this class.
|
void |
addInterface(SootClass interfaceClass)
Add the given class to the list of interfaces which are directly
implemented by this class.
|
void |
addMethod(SootMethod m)
Adds the given method to this class.
|
void |
checkLevel(int level)
Checks if the class has at lease the resolving level specified.
|
void |
checkLevelIgnoreResolving(int level)
Checks if the class has at lease the resolving level specified.
|
boolean |
containsBafBody()
Returns true if some method in this class has an active Baf body.
|
boolean |
declaresField(String subsignature)
Does this class declare a field with the given subsignature?
|
boolean |
declaresField(String name,
Type type)
Does this class declare a field with the given name and type.
|
boolean |
declaresFieldByName(String name)
Does this class declare a field with the given name?
|
boolean |
declaresMethod(NumberedString subsignature)
Does this class declare a method with the given subsignature?
|
boolean |
declaresMethod(String subsignature)
Does this class declare a method with the given subsignature?
|
boolean |
declaresMethod(String name,
List<Type> parameterTypes)
Does this class declare a method with the given name and parameter types?
|
boolean |
declaresMethod(String name,
List<Type> parameterTypes,
Type returnType)
Does this class declare a method with the given name, parameter types,
and return type?
|
boolean |
declaresMethodByName(String name)
Does this class declare a method with the given name?
|
SootField |
getField(String subsignature)
Returns the field of this class with the given subsignature.
|
SootField |
getField(String name,
Type type)
Returns the field of this class with the given name and type.
|
SootField |
getFieldByName(String name)
Returns the field of this class with the given name.
|
SootField |
getFieldByNameUnsafe(String name)
Returns the field of this class with the given name.
|
int |
getFieldCount()
Returns the number of fields in this class.
|
Chain<SootField> |
getFields()
Returns a backed Chain of fields.
|
SootField |
getFieldUnsafe(String subsignature)
Returns the field of this class with the given subsignature.
|
SootField |
getFieldUnsafe(String name,
Type type)
Returns the field of this class with the given name and type.
|
int |
getInterfaceCount()
Returns the number of interfaces being directly implemented by this
class.
|
Chain<SootClass> |
getInterfaces()
Returns a backed Chain of the interfaces that are directly implemented by
this class.
|
String |
getJavaPackageName() |
String |
getJavaStyleName() |
SootMethod |
getMethod(NumberedString subsignature)
Returns the method of this class with the given subsignature.
|
SootMethod |
getMethod(String subsignature) |
SootMethod |
getMethod(String name,
List<Type> parameterTypes)
Attempts to retrieve the method with the given name and parameters.
|
SootMethod |
getMethod(String name,
List<Type> parameterTypes,
Type returnType)
Attempts to retrieve the method with the given name, parameters and
return type.
|
SootMethod |
getMethodByName(String name)
Attempts to retrieve the method with the given name.
|
SootMethod |
getMethodByNameUnsafe(String name)
Attempts to retrieve the method with the given name.
|
int |
getMethodCount()
Returns the number of methods in this class.
|
List<SootMethod> |
getMethods() |
SootMethod |
getMethodUnsafe(NumberedString subsignature)
Returns the method of this class with the given subsignature.
|
SootMethod |
getMethodUnsafe(String subsignature) |
SootMethod |
getMethodUnsafe(String name,
List<Type> parameterTypes,
Type returnType)
Attempts to retrieve the method with the given name, parameters and
return type.
|
int |
getModifiers()
Returns the modifiers of this class.
|
String |
getName()
Returns the name of this class.
|
int |
getNumber() |
SootClass |
getOuterClass() |
String |
getPackageName()
Returns the package name of this class.
|
String |
getShortJavaStyleName() |
String |
getShortName() |
SootClass |
getSuperclass()
WARNING: interfaces are subclasses of the java.lang.Object class! Returns
the superclass of this class.
|
RefType |
getType()
Returns the RefType corresponding to this class.
|
boolean |
hasOuterClass() |
boolean |
hasRefType() |
boolean |
hasSuperclass()
WARNING: interfaces are subclasses of the java.lang.Object class! Does
this class have a superclass? False implies that this is the
java.lang.Object class.
|
boolean |
implementsInterface(String name)
Does this class directly implement the given interface? (see
getInterfaceCount())
|
boolean |
isAbstract()
Convenience method returning true if this class is abstract.
|
boolean |
isApplicationClass()
Convenience method returning true if this class is an application class.
|
boolean |
isConcrete()
Returns true if this class is not an interface and not abstract.
|
boolean |
isFinal()
Convenience method returning true if this class is final.
|
boolean |
isInnerClass() |
boolean |
isInScene() |
boolean |
isInterface()
Convenience method; returns true if this class is an interface.
|
boolean |
isJavaLibraryClass()
Sometimes we need to know which class is a JDK class.
|
boolean |
isLibraryClass()
Convenience method returning true if this class is a library class.
|
boolean |
isPhantom()
Convenience method returning true if this class is phantom.
|
boolean |
isPhantomClass()
Convenience method returning true if this class is a phantom class.
|
boolean |
isPrivate()
Convenience method returning true if this class is private.
|
boolean |
isProtected()
Convenience method returning true if this class is protected.
|
boolean |
isPublic()
Convenience method; returns true if this class is public.
|
boolean |
isStatic()
Convenience method returning true if this class is static.
|
Iterator<SootMethod> |
methodIterator()
Returns an iterator over the methods in this class.
|
void |
removeField(SootField f)
Removes the given field from this class.
|
void |
removeInterface(SootClass interfaceClass)
Removes the given class from the list of interfaces which are directly
implemented by this class.
|
void |
removeMethod(SootMethod m)
Removes the given method from this class.
|
void |
rename(String newName) |
void |
renameFieldsAndMethods(boolean privateOnly) |
int |
resolvingLevel() |
void |
setApplicationClass()
Makes this class an application class.
|
void |
setInScene(boolean isInScene)
Tells this class if it is being managed by a Scene.
|
void |
setLibraryClass()
Makes this class a library class.
|
void |
setModifiers(int modifiers)
Sets the modifiers for this class.
|
void |
setName(String name)
Sets the name of this class.
|
void |
setNumber(int number) |
void |
setOuterClass(SootClass c) |
void |
setPhantomClass()
Makes this class a phantom class.
|
void |
setRefType(RefType refType) |
void |
setResolvingLevel(int newLevel) |
void |
setSuperclass(SootClass c)
Sets the superclass of this class.
|
String |
toString()
Returns the name of this class.
|
void |
validate()
Validates this SootClass for logical errors.
|
void |
validate(List<ValidationException> exceptionList)
Validates this SootClass for logical errors.
|
addAllTagsOf, addTag, getJavaSourceStartColumnNumber, getJavaSourceStartLineNumber, getTag, getTags, hasTag, removeAllTags, removeTag
protected String name
protected String shortName
protected String fixedShortName
protected String packageName
protected String fixedPackageName
protected int modifiers
protected SmallNumberedMap<SootMethod> subSigToMethods
protected List<SootMethod> methodList
protected boolean isInScene
protected SootClass superClass
protected SootClass outerClass
protected boolean isPhantom
public static final String INVOKEDYNAMIC_DUMMY_CLASS_NAME
public static final int DANGLING
public static final int HIERARCHY
public static final int SIGNATURES
public static final int BODIES
public SootClass(String name, int modifiers)
public SootClass(String name)
public void checkLevel(int level)
level
- the resolution level, one of DANGLING, HIERARCHY, SIGNATURES,
and BODIESRuntimeException
- if the resolution is at an insufficient levelpublic void checkLevelIgnoreResolving(int level)
level
- the resolution level, one of DANGLING, HIERARCHY, SIGNATURES,
and BODIESRuntimeException
- if the resolution is at an insufficient levelpublic int resolvingLevel()
public void setResolvingLevel(int newLevel)
public boolean isInScene()
public void setInScene(boolean isInScene)
public int getFieldCount()
public void addField(SootField f)
public void removeField(SootField f)
public SootField getField(String name, Type type)
public SootField getFieldUnsafe(String name, Type type)
public SootField getFieldByName(String name)
public SootField getFieldByNameUnsafe(String name)
public SootField getField(String subsignature)
public SootField getFieldUnsafe(String subsignature)
public boolean declaresField(String subsignature)
public SootMethod getMethod(NumberedString subsignature)
public SootMethod getMethodUnsafe(NumberedString subsignature)
public boolean declaresMethod(NumberedString subsignature)
public SootMethod getMethod(String subsignature)
public SootMethod getMethodUnsafe(String subsignature)
public boolean declaresMethod(String subsignature)
public boolean declaresFieldByName(String name)
public boolean declaresField(String name, Type type)
public int getMethodCount()
public Iterator<SootMethod> methodIterator()
public List<SootMethod> getMethods()
public SootMethod getMethod(String name, List<Type> parameterTypes, Type returnType)
public SootMethod getMethodUnsafe(String name, List<Type> parameterTypes, Type returnType)
public SootMethod getMethod(String name, List<Type> parameterTypes)
public SootMethod getMethodByNameUnsafe(String name)
public SootMethod getMethodByName(String name)
public boolean declaresMethod(String name, List<Type> parameterTypes)
public boolean declaresMethod(String name, List<Type> parameterTypes, Type returnType)
public boolean declaresMethodByName(String name)
public void addMethod(SootMethod m)
public void removeMethod(SootMethod m)
public int getModifiers()
public void setModifiers(int modifiers)
public int getInterfaceCount()
public Chain<SootClass> getInterfaces()
public boolean implementsInterface(String name)
public void addInterface(SootClass interfaceClass)
public void removeInterface(SootClass interfaceClass)
public boolean hasSuperclass()
public SootClass getSuperclass()
public void setSuperclass(SootClass c)
public boolean hasOuterClass()
public SootClass getOuterClass()
public void setOuterClass(SootClass c)
public boolean isInnerClass()
public String getName()
public String getJavaStyleName()
public String getShortJavaStyleName()
public String getShortName()
public String getPackageName()
public String getJavaPackageName()
public void setName(String name)
public boolean isInterface()
public boolean isConcrete()
public boolean isPublic()
public boolean containsBafBody()
public void setRefType(RefType refType)
public boolean hasRefType()
public RefType getType()
public String toString()
public void renameFieldsAndMethods(boolean privateOnly)
public boolean isApplicationClass()
Scene.getApplicationClasses()
public void setApplicationClass()
public boolean isLibraryClass()
Scene.getLibraryClasses()
public void setLibraryClass()
public boolean isJavaLibraryClass()
public boolean isPhantomClass()
Scene.getPhantomClasses()
public void setPhantomClass()
public boolean isPhantom()
public boolean isPrivate()
public boolean isProtected()
public boolean isAbstract()
public boolean isFinal()
public boolean isStatic()
public final int getNumber()
getNumber
in interface Numberable
public final void setNumber(int number)
setNumber
in interface Numberable
public void rename(String newName)
public void validate()
public void validate(List<ValidationException> exceptionList)