public class SootClass extends AbstractHost implements Numberable
Modifier and Type | Field and Description |
---|---|
static int |
BODIES |
static int |
DANGLING |
protected Chain<SootField> |
fields |
protected java.lang.String |
fixedPackageName |
protected java.lang.String |
fixedShortName |
static int |
HIERARCHY |
protected Chain<SootClass> |
interfaces |
static java.lang.String |
INVOKEDYNAMIC_DUMMY_CLASS_NAME |
protected boolean |
isInScene |
protected boolean |
isPhantom |
protected java.util.List<SootMethod> |
methodList |
protected int |
modifiers |
protected java.lang.String |
name |
protected int |
number |
protected SootClass |
outerClass |
protected java.lang.String |
packageName |
protected java.lang.String |
shortName |
static int |
SIGNATURES |
protected SmallNumberedMap<SootMethod> |
subSigToMethods |
protected SootClass |
superClass |
col, line, mTagList
Constructor and Description |
---|
SootClass(java.lang.String name)
Constructs an empty SootClass with the given name and no modifiers.
|
SootClass(java.lang.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(java.lang.String subsignature)
Does this class declare a field with the given subsignature?
|
boolean |
declaresField(java.lang.String name,
Type type)
Does this class declare a field with the given name and type.
|
boolean |
declaresFieldByName(java.lang.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(java.lang.String subsignature)
Does this class declare a method with the given subsignature?
|
boolean |
declaresMethod(java.lang.String name,
java.util.List<Type> parameterTypes)
Does this class declare a method with the given name and parameter types?
|
boolean |
declaresMethod(java.lang.String name,
java.util.List<Type> parameterTypes,
Type returnType)
Does this class declare a method with the given name, parameter types, and
return type?
|
boolean |
declaresMethodByName(java.lang.String name)
Does this class declare a method with the given name?
|
SootField |
getField(java.lang.String subsignature)
Returns the field of this class with the given subsignature.
|
SootField |
getField(java.lang.String name,
Type type)
Returns the field of this class with the given name and type.
|
SootField |
getFieldByName(java.lang.String name)
Returns the field of this class with the given name.
|
SootField |
getFieldByNameUnsafe(java.lang.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(java.lang.String subsignature)
Returns the field of this class with the given subsignature.
|
SootField |
getFieldUnsafe(java.lang.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.
|
java.lang.String |
getJavaPackageName() |
java.lang.String |
getJavaStyleName() |
SootMethod |
getMethod(NumberedString subsignature)
Returns the method of this class with the given subsignature.
|
SootMethod |
getMethod(java.lang.String subsignature) |
SootMethod |
getMethod(java.lang.String name,
java.util.List<Type> parameterTypes)
Attempts to retrieve the method with the given name and parameters.
|
SootMethod |
getMethod(java.lang.String name,
java.util.List<Type> parameterTypes,
Type returnType)
Attempts to retrieve the method with the given name, parameters and return
type.
|
SootMethod |
getMethodByName(java.lang.String name)
Attempts to retrieve the method with the given name.
|
SootMethod |
getMethodByNameUnsafe(java.lang.String name)
Attempts to retrieve the method with the given name.
|
int |
getMethodCount()
Returns the number of methods in this class.
|
java.util.List<SootMethod> |
getMethods() |
SootMethod |
getMethodUnsafe(NumberedString subsignature)
Returns the method of this class with the given subsignature.
|
SootMethod |
getMethodUnsafe(java.lang.String subsignature) |
SootMethod |
getMethodUnsafe(java.lang.String name,
java.util.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.
|
java.lang.String |
getName()
Returns the name of this class.
|
int |
getNumber() |
SootField |
getOrAddField(SootField f) |
SootMethod |
getOrAddMethod(SootMethod m) |
SootClass |
getOuterClass() |
SootClass |
getOuterClassUnsafe()
This method returns the outer class, or null if no outer class has been
specified for this class.
|
java.lang.String |
getPackageName()
Returns the package name of this class.
|
java.lang.String |
getShortJavaStyleName() |
java.lang.String |
getShortName() |
SootClass |
getSuperclass()
WARNING: interfaces are subclasses of the java.lang.Object class! Returns the
superclass of this class.
|
SootClass |
getSuperclassUnsafe()
This method returns the superclass, or null if no superclass has been
specified for 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(java.lang.String name)
Does this class directly implement the given interface? (see
getInterfaceCount())
|
protected void |
initializeRefType(java.lang.String name)
Makes sure that there is a RefType pointing to this SootClass.
|
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 |
isEnum()
Convenience method; returns true if this class is an enumeration.
|
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.
|
boolean |
isSynchronized()
Convenience method; returns true if this class is synchronized.
|
protected java.lang.String |
levelToString(int level) |
java.util.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(java.lang.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(java.lang.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.
|
java.lang.String |
toString()
Returns the name of this class.
|
void |
validate()
Validates this SootClass for logical errors.
|
void |
validate(java.util.List<ValidationException> exceptionList)
Validates this SootClass for logical errors.
|
addAllTagsOf, addTag, getJavaSourceStartColumnNumber, getJavaSourceStartLineNumber, getTag, getTags, hasTag, removeAllTags, removeTag
protected java.lang.String name
protected java.lang.String shortName
protected java.lang.String fixedShortName
protected java.lang.String packageName
protected java.lang.String fixedPackageName
protected int modifiers
protected SmallNumberedMap<SootMethod> subSigToMethods
protected java.util.List<SootMethod> methodList
protected boolean isInScene
protected SootClass superClass
protected SootClass outerClass
protected boolean isPhantom
public static final java.lang.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
protected int number
public SootClass(java.lang.String name, int modifiers)
public SootClass(java.lang.String name)
protected void initializeRefType(java.lang.String name)
name
- The name of the new classprotected java.lang.String levelToString(int level)
public void checkLevel(int level)
level
- the resolution level, one of DANGLING, HIERARCHY, SIGNATURES, and
BODIESjava.lang.RuntimeException
- if the resolution is at an insufficient levelpublic void checkLevelIgnoreResolving(int level)
level
- the resolution level, one of DANGLING, HIERARCHY, SIGNATURES, and
BODIESjava.lang.RuntimeException
- 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(java.lang.String name, Type type)
public SootField getFieldUnsafe(java.lang.String name, Type type)
public SootField getFieldByName(java.lang.String name)
public SootField getFieldByNameUnsafe(java.lang.String name)
public SootField getField(java.lang.String subsignature)
public SootField getFieldUnsafe(java.lang.String subsignature)
public boolean declaresField(java.lang.String subsignature)
public SootMethod getMethod(NumberedString subsignature)
public SootMethod getMethodUnsafe(NumberedString subsignature)
public boolean declaresMethod(NumberedString subsignature)
public SootMethod getMethod(java.lang.String subsignature)
public SootMethod getMethodUnsafe(java.lang.String subsignature)
public boolean declaresMethod(java.lang.String subsignature)
public boolean declaresFieldByName(java.lang.String name)
public boolean declaresField(java.lang.String name, Type type)
public int getMethodCount()
public java.util.Iterator<SootMethod> methodIterator()
public java.util.List<SootMethod> getMethods()
public SootMethod getMethod(java.lang.String name, java.util.List<Type> parameterTypes, Type returnType)
public SootMethod getMethodUnsafe(java.lang.String name, java.util.List<Type> parameterTypes, Type returnType)
public SootMethod getMethod(java.lang.String name, java.util.List<Type> parameterTypes)
public SootMethod getMethodByNameUnsafe(java.lang.String name)
public SootMethod getMethodByName(java.lang.String name)
public boolean declaresMethod(java.lang.String name, java.util.List<Type> parameterTypes)
public boolean declaresMethod(java.lang.String name, java.util.List<Type> parameterTypes, Type returnType)
public boolean declaresMethodByName(java.lang.String name)
public void addMethod(SootMethod m)
public SootMethod getOrAddMethod(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(java.lang.String name)
public void addInterface(SootClass interfaceClass)
public void removeInterface(SootClass interfaceClass)
public boolean hasSuperclass()
public SootClass getSuperclass()
public SootClass getSuperclassUnsafe()
public void setSuperclass(SootClass c)
public boolean hasOuterClass()
public SootClass getOuterClass()
public SootClass getOuterClassUnsafe()
public void setOuterClass(SootClass c)
public boolean isInnerClass()
public java.lang.String getName()
public java.lang.String getJavaStyleName()
public java.lang.String getShortJavaStyleName()
public java.lang.String getShortName()
public java.lang.String getPackageName()
public java.lang.String getJavaPackageName()
public void setName(java.lang.String name)
public boolean isInterface()
public boolean isEnum()
public boolean isSynchronized()
public boolean isConcrete()
public boolean isPublic()
public boolean containsBafBody()
public void setRefType(RefType refType)
public boolean hasRefType()
public RefType getType()
public java.lang.String toString()
toString
in class java.lang.Object
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 void setNumber(int number)
setNumber
in interface Numberable
public void rename(java.lang.String newName)
public void validate()
public void validate(java.util.List<ValidationException> exceptionList)