Package sootup.java.core
Class JavaSootClass
java.lang.Object
sootup.java.core.JavaSootClass
- All Implemented Interfaces:
HasPosition
,SootClass
,HasAnnotation
- Direct Known Subclasses:
JavaAnnotationSootClass
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionJavaSootClass
(SootClassSource classSource, SourceType sourceType) JavaSootClass
(SootClassSource classSource, SourceType sourceType, Set<JavaSootMethod> methods, Set<? extends SootField> fields, Set<ClassModifier> modifiers, Set<? extends ClassType> interfaces, Optional<? extends ClassType> superclass, Optional<? extends ClassType> outerClass, Position position) -
Method Summary
Modifier and TypeMethodDescriptionGet all annotations that are directly attached to this class.@NonNull SootClassSource
@NonNull Optional<JavaSootField>
Returns the field of this class with the given name.@NonNull Optional<JavaSootField>
getField
(@NonNull FieldSubSignature subSignature) Attemtps to retrieve the field with the given FieldSubSignature.@NonNull Set<JavaSootField>
Returns a backed Chain of the interfaces that are directly implemented by this class.@NonNull Optional<JavaSootMethod>
Attempts to retrieve the method with the given name and parameters.@NonNull Optional<JavaSootMethod>
getMethod
(@NonNull MethodSubSignature subSignature) Attempts to retrieve the method with the given subSignature.@NonNull Set<JavaSootMethod>
@NonNull Set<JavaSootMethod>
getMethodsByName
(@NonNull String name) Attempts to retrieve the method with the given name.@NonNull Set<ClassModifier>
Returns the modifiers of this class in an immutable set.@NonNull String
getName()
This method returns the outer class.@NonNull Position
Line and column information of the corresponding code object that this represents.WARNING: interfaces in Java are subclasses of the java.lang.Object class!getType()
Returns the ClassSignature of this class.boolean
boolean
WARNING: interfaces are subclasses of the java.lang.Object class!boolean
implementsInterface
(@NonNull ClassType classSignature) Does this class directly implement the given interface?boolean
Convenience method returning true if this class is abstract.boolean
boolean
Returns true if this class is an application class.boolean
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
boolean
Convenience method; returns true if this class is an interface.boolean
Returns true if this class is a library class.boolean
Convenience method returning true if this class is private.boolean
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
isSuper()
Convenience method; returns true if this class is synchronized.@NonNull String
print()
Returns the serialized Jimple of this SootClass as String@NonNull String
toString()
Returns the name of this class.@NonNull JavaSootClass
withClassSource
(@NonNull SootClassSource classSource) @NonNull JavaSootClass
withFields
(@NonNull Collection<JavaSootField> fields) @NonNull JavaSootClass
withMethods
(@NonNull Collection<JavaSootMethod> methods) @NonNull JavaSootClass
withModifiers
(@NonNull Set<ClassModifier> modifiers) @NonNull JavaSootClass
withOuterClass
(@NonNull Optional<JavaClassType> outerClass) @NonNull JavaSootClass
withPosition
(@Nullable Position position) @NonNull JavaSootClass
withReplacedField
(@NonNull JavaSootField toReplace, @NonNull JavaSootField replacement) @NonNull JavaSootClass
withReplacedMethod
(@NonNull JavaSootMethod toReplace, @NonNull JavaSootMethod replacement) @NonNull JavaSootClass
withSourceType
(@NonNull SourceType sourceType) @NonNull JavaSootClass
withSuperclass
(@NonNull Optional<JavaClassType> superclass)
-
Constructor Details
-
JavaSootClass
-
JavaSootClass
public JavaSootClass(SootClassSource classSource, SourceType sourceType, Set<JavaSootMethod> methods, Set<? extends SootField> fields, Set<ClassModifier> modifiers, Set<? extends ClassType> interfaces, Optional<? extends ClassType> superclass, Optional<? extends ClassType> outerClass, Position position)
-
-
Method Details
-
getMethod
Description copied from interface:SootClass
Attempts to retrieve the method with the given subSignature. This method may throw an AmbiguousStateException if there are more than one method with the given subSignature. If no method with the given is found, null is returned. -
getField
Description copied from interface:SootClass
Attemtps to retrieve the field with the given FieldSubSignature. -
getField
Description copied from interface:SootClass
Returns the field of this class with the given name. Throws a ResolveException if there is more than one field with the given name. Returns null if no field with the given name exists. -
getMethod
public @NonNull Optional<JavaSootMethod> getMethod(@NonNull String name, @NonNull Iterable<? extends Type> parameterTypes) Description copied from interface:SootClass
Attempts to retrieve the method with the given name and parameters. This method may throw an ResolveException if there is more than one method with the given name and parameter. -
getMethodsByName
Description copied from interface:SootClass
Attempts to retrieve the method with the given name. This method will return an empty Set if there is no method with the given name.- Specified by:
getMethodsByName
in interfaceSootClass
- Parameters:
name
- the name of the method- Returns:
- a set of methods that have the given name
-
getMethods
- Specified by:
getMethods
in interfaceSootClass
-
getFields
-
getModifiers
Returns the modifiers of this class in an immutable set.- Specified by:
getModifiers
in interfaceSootClass
-
getInterfaces
Returns a backed Chain of the interfaces that are directly implemented by this class. Note that direct implementation corresponds to an "implements" keyword in the Java class file and that this class may still be implementing additional interfaces in the usual sense by being a subclass of a class which directly implements some interfaces.- Specified by:
getInterfaces
in interfaceSootClass
-
implementsInterface
Does this class directly implement the given interface? (see getInterfaceCount()) -
hasSuperclass
public 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. Note that interfaces are subclasses of the java.lang.Object class.- Specified by:
hasSuperclass
in interfaceSootClass
-
getSuperclass
WARNING: interfaces in Java are subclasses of the java.lang.Object class! Returns the superclass of this class. (see hasSuperclass())- Specified by:
getSuperclass
in interfaceSootClass
-
hasOuterClass
public boolean hasOuterClass()- Specified by:
hasOuterClass
in interfaceSootClass
-
getOuterClass
This method returns the outer class.- Specified by:
getOuterClass
in interfaceSootClass
-
isInnerClass
public boolean isInnerClass()- Specified by:
isInnerClass
in interfaceSootClass
-
getType
Returns the ClassSignature of this class. -
isInterface
public boolean isInterface()Convenience method; returns true if this class is an interface.- Specified by:
isInterface
in interfaceSootClass
-
isEnum
public boolean isEnum()Convenience method; returns true if this class is an enumeration. -
isSuper
public boolean isSuper()Convenience method; returns true if this class is synchronized. -
isConcrete
public boolean isConcrete()Returns true if this class is not an interface and not abstract.- Specified by:
isConcrete
in interfaceSootClass
-
isPublic
public boolean isPublic()Convenience method; returns true if this class is public. -
toString
Returns the name of this class. -
print
Returns the serialized Jimple of this SootClass as String -
isApplicationClass
public boolean isApplicationClass()Returns true if this class is an application class.- Specified by:
isApplicationClass
in interfaceSootClass
-
isLibraryClass
public boolean isLibraryClass()Returns true if this class is a library class.- Specified by:
isLibraryClass
in interfaceSootClass
-
isPrivate
public boolean isPrivate()Convenience method returning true if this class is private. -
isProtected
public boolean isProtected()Convenience method returning true if this class is protected.- Specified by:
isProtected
in interfaceSootClass
-
isAbstract
public boolean isAbstract()Convenience method returning true if this class is abstract.- Specified by:
isAbstract
in interfaceSootClass
-
isFinal
public boolean isFinal()Convenience method returning true if this class is final. -
isStatic
public boolean isStatic()Convenience method returning true if this class is static. -
isAnnotation
public boolean isAnnotation()- Specified by:
isAnnotation
in interfaceSootClass
-
getPosition
Description copied from interface:HasPosition
Line and column information of the corresponding code object that this represents.- Specified by:
getPosition
in interfaceHasPosition
- Specified by:
getPosition
in interfaceSootClass
- Returns:
- a
Position
containing position information.
-
getClassSource
- Specified by:
getClassSource
in interfaceSootClass
-
getName
-
withClassSource
-
withSourceType
-
withMethods
-
withReplacedField
public @NonNull JavaSootClass withReplacedField(@NonNull JavaSootField toReplace, @NonNull JavaSootField replacement) -
withFields
-
withModifiers
-
withReplacedMethod
public @NonNull JavaSootClass withReplacedMethod(@NonNull JavaSootMethod toReplace, @NonNull JavaSootMethod replacement) -
withSuperclass
-
withOuterClass
-
withPosition
-
getAnnotations
Get all annotations that are directly attached to this class.This includes "visible" and "invisible" annotations. Note that inherited annotations are not part of this iterable.
- Specified by:
getAnnotations
in interfaceHasAnnotation
-