Package sootup.java.core
Class OverridingJavaClassSource
java.lang.Object
sootup.java.core.JavaSootClassSource
sootup.java.core.OverridingJavaClassSource
- All Implemented Interfaces:
SootClassSource,HasGenericSignature
Allows for replacing specific parts of a class, such as fields and methods. Every part that is
not overridden is resolved from the
SootClassSource delegate provided in the constructor.
To create a class source from scratch (e.g. classes that are batchparsed or synthesized in
tests) where all information is already available, use InMemoryJavaClassSource.
To alter the results of invocations to e.g. resolveFields(), simply call withFields(Collection) to obtain a new OverridingJavaClassSource. The new instance will
then use the supplied value instead of calling resolveFields() on the delegate.
- Author:
- Christian Brüggemann, Hasitha Rajapakse
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDefines aOverridingJavaClassSource.OverridingJavaClassSourceBuilderbuilder. -
Field Summary
Fields inherited from class sootup.java.core.JavaSootClassSource
analysisInputLocation, classSignature, sourcePath -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanEven if a the signature changes, the classource remains the same, e.g., if it is associated to an automatic module sinthashCode()@NonNull Iterable<AnnotationUsage>@NonNull Collection<? extends SootField>Reads from the source to retrieve its fields.Reads from the source to retrieve its directly implemented interfaces.@NonNull Collection<? extends SootMethod>Reads from the source to retrieve its methods.@NonNull Set<ClassModifier>Reads from the source to retrieve its modifiers.Reads from the source to retrieve its outer class, if this is an inner class.@NonNull PositionReads from the source to retrieve its position in the source code.Reads from the source to retrieve its superclass, if present.toString()@NonNull OverridingJavaClassSourcewithFields(@NonNull Collection<JavaSootField> overriddenSootFields) @NonNull OverridingJavaClassSourcewithInterfaces(@NonNull Set<JavaClassType> overriddenInterfaces) @NonNull OverridingJavaClassSourcewithMethods(@NonNull Collection<JavaSootMethod> overriddenSootMethods) @NonNull OverridingJavaClassSourcewithModifiers(@NonNull Set<ClassModifier> overriddenModifiers) @NonNull OverridingJavaClassSourcewithOuterClass(@NonNull Optional<JavaClassType> overriddenOuterClass) @NonNull OverridingJavaClassSourcewithPosition(@Nullable Position position) @NonNull OverridingJavaClassSourcewithReplacedField(@NonNull JavaSootField toReplace, @NonNull JavaSootField replacement) @NonNull OverridingJavaClassSourcewithReplacedMethod(@NonNull JavaSootMethod toReplace, @NonNull JavaSootMethod replacement) @NonNull OverridingJavaClassSourcewithSuperclass(@NonNull Optional<JavaClassType> overriddenSuperclass) Methods inherited from class sootup.java.core.JavaSootClassSource
buildClass, getAnalysisInputLocation, getClassFileMetadata, getClassType, getGenericSignature, getSourcePath
-
Constructor Details
-
OverridingJavaClassSource
-
-
Method Details
-
resolveMethods
Description copied from interface:SootClassSourceReads from the source to retrieve its methods. This may be an expensive operation.- Throws:
ResolveException
-
resolveFields
Description copied from interface:SootClassSourceReads from the source to retrieve its fields. This may be an expensive operation.- Throws:
ResolveException
-
resolveModifiers
Description copied from interface:SootClassSourceReads from the source to retrieve its modifiers. This may be an expensive operation. -
resolveInterfaces
Description copied from interface:SootClassSourceReads from the source to retrieve its directly implemented interfaces. This may be an expensive operation. -
resolveSuperclass
Description copied from interface:SootClassSourceReads from the source to retrieve its superclass, if present. This may be an expensive operation. -
resolveOuterClass
Description copied from interface:SootClassSourceReads from the source to retrieve its outer class, if this is an inner class. This may be an expensive operation.- Returns:
-
resolvePosition
Description copied from interface:SootClassSourceReads from the source to retrieve its position in the source code. This may be an expensive operation. -
resolveAnnotations
- Specified by:
resolveAnnotationsin classJavaSootClassSource
-
equals
Description copied from class:JavaSootClassSourceEven if a the signature changes, the classource remains the same, e.g., if it is associated to an automatic module s- Overrides:
equalsin classJavaSootClassSource- Parameters:
o- the object to compare with- Returns:
- both objects are logically equal
-
hashCode
public int hashCode()- Overrides:
hashCodein classJavaSootClassSource
-
toString
-
withReplacedMethod
public @NonNull OverridingJavaClassSource withReplacedMethod(@NonNull JavaSootMethod toReplace, @NonNull JavaSootMethod replacement) -
withMethods
public @NonNull OverridingJavaClassSource withMethods(@NonNull Collection<JavaSootMethod> overriddenSootMethods) -
withReplacedField
public @NonNull OverridingJavaClassSource withReplacedField(@NonNull JavaSootField toReplace, @NonNull JavaSootField replacement) -
withFields
public @NonNull OverridingJavaClassSource withFields(@NonNull Collection<JavaSootField> overriddenSootFields) -
withModifiers
public @NonNull OverridingJavaClassSource withModifiers(@NonNull Set<ClassModifier> overriddenModifiers) -
withInterfaces
public @NonNull OverridingJavaClassSource withInterfaces(@NonNull Set<JavaClassType> overriddenInterfaces) -
withSuperclass
public @NonNull OverridingJavaClassSource withSuperclass(@NonNull Optional<JavaClassType> overriddenSuperclass) -
withOuterClass
public @NonNull OverridingJavaClassSource withOuterClass(@NonNull Optional<JavaClassType> overriddenOuterClass) -
withPosition
-