Package sootup.core.frontend
Class OverridingClassSource
java.lang.Object
sootup.core.frontend.AbstractClassSource
sootup.core.frontend.SootClassSource
sootup.core.frontend.OverridingClassSource
Allows for replacing specific parts of a class, such as fields and methods or, allows to resolve
classes that are batchparsed like .java files using wala java source frontend or in tests where
all information is already existing.
When replacing specific parts of a class by default, it delegates to the SootClassSource
delegate provided in the constructor.
To alter the results of invocations to e.g. resolveFields()
, simply call withFields(Collection)
to obtain a new OverridingClassSource
. The new instance will
then use the supplied value instead of calling resolveFields()
on the delegate.
- Author:
- Christian Brüggemann, Hasitha Rajapakse
-
Field Summary
Fields inherited from class sootup.core.frontend.AbstractClassSource
classSignature, classSource, sourcePath
-
Constructor Summary
ConstructorDescriptionOverridingClassSource
(Set<SootMethod> sootMethods, Set<SootField> sootFields, EnumSet<ClassModifier> modifiers, Set<ClassType> interfaces, ClassType superClass, ClassType outerClass, Position position, Path sourcePath, ClassType classType, AnalysisInputLocation srcNamespace) Class source where all information already availableOverridingClassSource
(SootClassSource delegate) -
Method Summary
Modifier and TypeMethodDescriptionbuildClass
(SourceType sourceType) boolean
Even if a the signature changes, the classource remains the same, e.g., if it is associated to an automatic module sint
hashCode()
Reads from the source to retrieve its fields.Reads from the source to retrieve its directly implemented interfaces.Reads from the source to retrieve its methods.Reads from the source to retrieve its modifiers.Reads from the source to retrieve its outer class, if this is an inner class.Reads from the source to retrieve its position in the source code.Reads from the source to retrieve its superclass, if present.toString()
withFields
(Collection<SootField> overriddenSootFields) withInterfaces
(Set<ClassType> overriddenInterfaces) withMethods
(Collection<SootMethod> overriddenSootMethods) withModifiers
(Set<ClassModifier> overriddenModifiers) withOuterClass
(Optional<ClassType> overriddenOuterClass) withPosition
(Position position) withReplacedField
(SootField toReplace, SootField replacement) withReplacedMethod
(SootMethod toReplace, SootMethod replacement) withSuperclass
(Optional<ClassType> overriddenSuperclass) Methods inherited from class sootup.core.frontend.AbstractClassSource
getAnalysisInputLocation, getClassType, getSourcePath
-
Constructor Details
-
OverridingClassSource
-
OverridingClassSource
public OverridingClassSource(@Nonnull Set<SootMethod> sootMethods, @Nonnull Set<SootField> sootFields, @Nonnull EnumSet<ClassModifier> modifiers, @Nonnull Set<ClassType> interfaces, @Nonnull ClassType superClass, @Nonnull ClassType outerClass, @Nonnull Position position, @Nonnull Path sourcePath, @Nonnull ClassType classType, @Nonnull AnalysisInputLocation srcNamespace) Class source where all information already available
-
-
Method Details
-
resolveMethods
Description copied from class:SootClassSource
Reads from the source to retrieve its methods. This may be an expensive operation.- Specified by:
resolveMethods
in classSootClassSource
- Throws:
ResolveException
-
resolveFields
Description copied from class:SootClassSource
Reads from the source to retrieve its fields. This may be an expensive operation.- Specified by:
resolveFields
in classSootClassSource
- Throws:
ResolveException
-
resolveModifiers
Description copied from class:SootClassSource
Reads from the source to retrieve its modifiers. This may be an expensive operation.- Specified by:
resolveModifiers
in classSootClassSource
-
resolveInterfaces
Description copied from class:SootClassSource
Reads from the source to retrieve its directly implemented interfaces. This may be an expensive operation.- Specified by:
resolveInterfaces
in classSootClassSource
-
resolveSuperclass
Description copied from class:SootClassSource
Reads from the source to retrieve its superclass, if present. This may be an expensive operation.- Specified by:
resolveSuperclass
in classSootClassSource
-
resolveOuterClass
Description copied from class:SootClassSource
Reads from the source to retrieve its outer class, if this is an inner class. This may be an expensive operation.- Specified by:
resolveOuterClass
in classSootClassSource
- Returns:
-
resolvePosition
Description copied from class:SootClassSource
Reads from the source to retrieve its position in the source code. This may be an expensive operation.- Specified by:
resolvePosition
in classSootClassSource
-
buildClass
- Specified by:
buildClass
in classAbstractClassSource
- Parameters:
sourceType
- instantiates the Subclass of AbstractClassSource to create a *SootClass- Returns:
- a *SootClass
-
equals
Description copied from class:AbstractClassSource
Even if a the signature changes, the classource remains the same, e.g., if it is associated to an automatic module s- Overrides:
equals
in classAbstractClassSource
- Parameters:
o
- the object to compare with- Returns:
- both objects are logically equal
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractClassSource
-
toString
-
withReplacedMethod
@Nonnull public OverridingClassSource withReplacedMethod(@Nonnull SootMethod toReplace, @Nonnull SootMethod replacement) -
withMethods
@Nonnull public OverridingClassSource withMethods(@Nonnull Collection<SootMethod> overriddenSootMethods) -
withReplacedField
-
withFields
@Nonnull public OverridingClassSource withFields(@Nonnull Collection<SootField> overriddenSootFields) -
withModifiers
@Nonnull public OverridingClassSource withModifiers(@Nonnull Set<ClassModifier> overriddenModifiers) -
withInterfaces
-
withSuperclass
@Nonnull public OverridingClassSource withSuperclass(@Nonnull Optional<ClassType> overriddenSuperclass) -
withOuterClass
@Nonnull public OverridingClassSource withOuterClass(@Nonnull Optional<ClassType> overriddenOuterClass) -
withPosition
-