Package sootup.java.core
Class InMemoryJavaClassSource
java.lang.Object
sootup.java.core.JavaSootClassSource
sootup.java.core.InMemoryJavaClassSource
- All Implemented Interfaces:
SootClassSource,HasGenericSignature
A class source where all information is already available in memory, e.g. classes that are
batchparsed (like .jimple files) or synthesized in tests.
To replace parts of an existing class source, wrap it in an OverridingJavaClassSource.
- Author:
- Christian Brüggemann, Hasitha Rajapakse, Ashik Mogasavara Ravikumar
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interfaceOptional parts; every part that is not set defaults to absent/empty. -
Field Summary
Fields inherited from class sootup.java.core.JavaSootClassSource
analysisInputLocation, classSignature, sourcePath -
Constructor Summary
ConstructorsConstructorDescriptionInMemoryJavaClassSource(@NonNull Set<JavaSootMethod> sootMethods, @NonNull Set<JavaSootField> sootFields, @NonNull EnumSet<ClassModifier> modifiers, @NonNull Set<JavaClassType> interfaces, @Nullable JavaClassType superClass, @Nullable JavaClassType outerClass, @NonNull Position position, @NonNull Path sourcePath, @NonNull ClassType classType, @NonNull AnalysisInputLocation inputLocation) InMemoryJavaClassSource(@NonNull AnalysisInputLocation srcNamespace, @NonNull Path sourcePath, @NonNull ClassType classType, @Nullable JavaClassType superClass, @NonNull Set<JavaClassType> interfaces, @Nullable JavaClassType outerClass, @NonNull Set<JavaSootField> sootFields, @NonNull Set<JavaSootMethod> sootMethods, @NonNull Position position, @NonNull EnumSet<ClassModifier> modifiers, @NonNull Iterable<AnnotationUsage> annotations, @NonNull Iterable<AnnotationUsage> methodAnnotations, @Nullable Iterable<AnnotationUsage> fieldAnnotations) InMemoryJavaClassSource(@NonNull AnalysisInputLocation srcNamespace, @NonNull Path sourcePath, @NonNull ClassType classType, @Nullable JavaClassType superClass, @NonNull Set<JavaClassType> interfaces, @Nullable JavaClassType outerClass, @NonNull Set<JavaSootField> sootFields, @NonNull Set<JavaSootMethod> sootMethods, @NonNull Position position, @NonNull EnumSet<ClassModifier> modifiers, @NonNull Iterable<AnnotationUsage> annotations, @NonNull Iterable<AnnotationUsage> methodAnnotations, @Nullable Iterable<AnnotationUsage> fieldAnnotations, @NonNull JavaClassFileMetadata classFileMetadata) Creates a fully resolved class source with immutable source and nesting attributes. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull InMemoryJavaClassSource.AnalysisInputLocationStepbuilder()Starts a stepwise builder: the input location and the class type are mandatory.booleanEven 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()Methods inherited from class sootup.java.core.JavaSootClassSource
buildClass, getAnalysisInputLocation, getClassFileMetadata, getClassType, getGenericSignature, getSourcePath
-
Constructor Details
-
InMemoryJavaClassSource
public InMemoryJavaClassSource(@NonNull AnalysisInputLocation srcNamespace, @NonNull Path sourcePath, @NonNull ClassType classType, @Nullable JavaClassType superClass, @NonNull Set<JavaClassType> interfaces, @Nullable JavaClassType outerClass, @NonNull Set<JavaSootField> sootFields, @NonNull Set<JavaSootMethod> sootMethods, @NonNull Position position, @NonNull EnumSet<ClassModifier> modifiers, @NonNull Iterable<AnnotationUsage> annotations, @NonNull Iterable<AnnotationUsage> methodAnnotations, @Nullable Iterable<AnnotationUsage> fieldAnnotations) -
InMemoryJavaClassSource
public InMemoryJavaClassSource(@NonNull AnalysisInputLocation srcNamespace, @NonNull Path sourcePath, @NonNull ClassType classType, @Nullable JavaClassType superClass, @NonNull Set<JavaClassType> interfaces, @Nullable JavaClassType outerClass, @NonNull Set<JavaSootField> sootFields, @NonNull Set<JavaSootMethod> sootMethods, @NonNull Position position, @NonNull EnumSet<ClassModifier> modifiers, @NonNull Iterable<AnnotationUsage> annotations, @NonNull Iterable<AnnotationUsage> methodAnnotations, @Nullable Iterable<AnnotationUsage> fieldAnnotations, @NonNull JavaClassFileMetadata classFileMetadata) Creates a fully resolved class source with immutable source and nesting attributes.- Parameters:
srcNamespace- the input location containing the classsourcePath- the path to the classfileclassType- the class typesuperClass- the superclass, ornullif absentinterfaces- the implemented interfacesouterClass- the outer class, ornullif absentsootFields- the fieldssootMethods- the methodsposition- the source positionmodifiers- the class modifiersannotations- the class annotationsmethodAnnotations- the method annotationsfieldAnnotations- the field annotationsclassFileMetadata- the source and nesting attributes
-
InMemoryJavaClassSource
public InMemoryJavaClassSource(@NonNull Set<JavaSootMethod> sootMethods, @NonNull Set<JavaSootField> sootFields, @NonNull EnumSet<ClassModifier> modifiers, @NonNull Set<JavaClassType> interfaces, @Nullable JavaClassType superClass, @Nullable JavaClassType outerClass, @NonNull Position position, @NonNull Path sourcePath, @NonNull ClassType classType, @NonNull AnalysisInputLocation inputLocation)
-
-
Method Details
-
resolveMethods
Description copied from interface:SootClassSourceReads from the source to retrieve its methods. This may be an expensive operation. -
resolveFields
Description copied from interface:SootClassSourceReads from the source to retrieve its fields. This may be an expensive operation. -
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
-
builder
Starts a stepwise builder: the input location and the class type are mandatory.
-