Class EagerLoadingStrategy
- All Implemented Interfaces:
LoadingStrategy
JavaView up front, at construction time, then releases the
view's input locations. Used by JavaEagerView.
Since initialize(sootup.java.core.views.JavaView) has already resolved (and cached) everything reachable, a class not
found in the cache by the time resolveOnCacheMiss(sootup.java.core.views.JavaView, sootup.core.types.ClassType) runs will never be found - there is
nothing left to probe, and the input locations are closed besides. This carries no absence-set
bookkeeping, unlike OnDemandLoadingStrategy, because none is needed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinitialize(@NonNull JavaView view) Called exactly once, as the last statement ofJavaView's constructor, after all ofJavaView's own fields (inputLocations,cache,loadingStrategy,identifierFactory) have been assigned.@NonNull Optional<JavaSootClass>resolveOnCacheMiss(@NonNull JavaView view, @NonNull ClassType type) Called fromJavaView.getClass(ClassType)after a cache miss, while holding the owning view's monitor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface sootup.java.core.views.LoadingStrategy
makeAvailable
-
Constructor Details
-
EagerLoadingStrategy
public EagerLoadingStrategy()
-
-
Method Details
-
initialize
Description copied from interface:LoadingStrategyCalled exactly once, as the last statement ofJavaView's constructor, after all ofJavaView's own fields (inputLocations,cache,loadingStrategy,identifierFactory) have been assigned. The default does nothing; only the eager strategy overrides this to resolve every class up front.Because this runs before any subclass's own constructor body, any virtual call this makes on
viewmust not depend on subclass fields that a subclass constructor would otherwise have initialized first. Do not wire the eager strategy into aJavaViewsubclass that overridesgetClasses()orbuildClassFrom(...)without re-checking this.- Specified by:
initializein interfaceLoadingStrategy
-
resolveOnCacheMiss
public @NonNull Optional<JavaSootClass> resolveOnCacheMiss(@NonNull JavaView view, @NonNull ClassType type) Description copied from interface:LoadingStrategyCalled fromJavaView.getClass(ClassType)after a cache miss, while holding the owning view's monitor. Returns the resolved class, orOptional.empty()iftypecannot be resolved.- Specified by:
resolveOnCacheMissin interfaceLoadingStrategy
-