Package sootup.java.core.views
Class JavaView
java.lang.Object
sootup.core.views.AbstractView
sootup.java.core.views.JavaView
- All Implemented Interfaces:
View
- Direct Known Subclasses:
JavaEagerView,JavaModuleView,MutableJavaView
The Class JavaView manages the Java classes of the application being analyzed. This view cannot
be altered after its creation.
- Author:
- Linghui Luo created on 31.07.2018, Jan Martin Persch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final @NonNull ClassCacheprotected final @NonNull JavaIdentifierFactoryprotected final @NonNull List<AnalysisInputLocation>protected booleanprotected final @NonNull LoadingStrategy -
Constructor Summary
ConstructorsModifierConstructorDescriptionJavaView(@NonNull List<AnalysisInputLocation> inputLocations) JavaView(@NonNull List<AnalysisInputLocation> inputLocations, @NonNull ClassCacheProvider cacheProvider) JavaView(@NonNull List<AnalysisInputLocation> inputLocations, @NonNull ClassCacheProvider cacheProvider, @NonNull LoadingStrategy loadingStrategy) protectedJavaView(@NonNull List<AnalysisInputLocation> inputLocations, @NonNull ClassCacheProvider cacheProvider, @NonNull LoadingStrategy loadingStrategy, @NonNull JavaIdentifierFactory idf) JavaView(@NonNull AnalysisInputLocation inputLocation) -
Method Summary
Modifier and TypeMethodDescriptionprotected @NonNull JavaSootClassbuildClassFrom(JavaSootClassSource classSource) protected voidforgetAbsence(@NonNull ClassType type) Forgets thattypewas previously resolved as absent, so that the nextgetClass(ClassType)queries the input locations again.intReturns the number of classes that are currently stored in the cache.@NonNull Optional<JavaSootClass>Resolves the class matching the providedClassType.@NonNull Stream<JavaSootClass>Resolves all classes that are part of the view and stores them in the cache.protected @NonNull Optional<JavaSootClassSource>getClassSource(@NonNull ClassType type) @NonNull Optional<JavaSootField>getField(@NonNull FieldSignature signature) @NonNull JavaIdentifierFactoryReturns theIdentifierFactoryfor this view.@NonNull Optional<JavaSootMethod>getMethod(@NonNull MethodSignature signature) resolve and check for accessibility of the class from a given package * TODO: incorporate AccessUtil @NonNull public synchronized Optional<T> getClass( @NonNull PackageName entryPackage, @NonNull ClassType type) { Optional<T> aClass = getClass(type); if (aClass.isPresent() && AccessUtil.isAccessible(entryPackage, aClass.get()) ) { return Optional.empty(); } return aClass; }Methods inherited from class sootup.core.views.AbstractView
getTypeHierarchyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface sootup.core.views.View
getClassOrThrow
-
Field Details
-
identifierFactory
-
inputLocations
-
cache
-
loadingStrategy
-
isFullyResolved
protected volatile boolean isFullyResolved
-
-
Constructor Details
-
JavaView
-
JavaView
-
JavaView
public JavaView(@NonNull List<AnalysisInputLocation> inputLocations, @NonNull ClassCacheProvider cacheProvider) -
JavaView
public JavaView(@NonNull List<AnalysisInputLocation> inputLocations, @NonNull ClassCacheProvider cacheProvider, @NonNull LoadingStrategy loadingStrategy) -
JavaView
protected JavaView(@NonNull List<AnalysisInputLocation> inputLocations, @NonNull ClassCacheProvider cacheProvider, @NonNull LoadingStrategy loadingStrategy, @NonNull JavaIdentifierFactory idf)
-
-
Method Details
-
getClasses
Resolves all classes that are part of the view and stores them in the cache. -
getClass
Resolves the class matching the providedClassType.- Returns:
- A class with given signature.
-
forgetAbsence
Forgets thattypewas previously resolved as absent, so that the nextgetClass(ClassType)queries the input locations again. Subclasses that make a class available after construction should call this. Delegates to the activeLoadingStrategy; a no-op under the eager strategy, which tracks no absence state to forget - by design, not a bug, since a class absent after an eager load can never become present.It is not load-bearing for
MutableJavaViewas currently written:getClass(ClassType)consultscachebefore the loading strategy, andaddClasspopulates that cache, so a stale absence record is shadowed anyway. It guards the cases where that no longer holds - if the two checks are ever reordered, or if a mutating view is given an evicting cache such asLRUCache, where an added class can disappear from the cache again and let the stale record surface. -
getMethod
Description copied from class:AbstractViewresolve and check for accessibility of the class from a given package * TODO: incorporate AccessUtil @NonNull public synchronized Optional<T> getClass( @NonNull PackageName entryPackage, @NonNull ClassType type) { Optional<T> aClass = getClass(type); if (aClass.isPresent() && AccessUtil.isAccessible(entryPackage, aClass.get()) ) { return Optional.empty(); } return aClass; }- Specified by:
getMethodin interfaceView- Overrides:
getMethodin classAbstractView
-
getField
- Specified by:
getFieldin interfaceView- Overrides:
getFieldin classAbstractView
-
getIdentifierFactory
Description copied from interface:ViewReturns theIdentifierFactoryfor this view. -
getCachedClassesCount
public int getCachedClassesCount()Returns the number of classes that are currently stored in the cache. -
getClassSource
-
buildClassFrom
-