Class OnDemandLoadingStrategy

java.lang.Object
sootup.java.core.views.OnDemandLoadingStrategy
All Implemented Interfaces:
LoadingStrategy

public class OnDemandLoadingStrategy extends Object implements LoadingStrategy
Lazily resolves classes on first lookup, the default LoadingStrategy for JavaView.

Memoizes types that no AnalysisInputLocation could provide a class source for. The owning view's positive cache only memoizes successful resolutions, so without this every repeated lookup of an absent type would re-run getClassSource, which probes every input location - including the JDK jimage filesystem - while holding the view's monitor. Call graph construction against an incomplete classpath does exactly that: it repeats a handful of failing lookups thousands of times.

Not thread-safe on its own; callers only touch absentClasses while holding the owning JavaView's monitor (see JavaView.getClass(ClassType) / JavaView.forgetAbsence(ClassType), both synchronized). Do not share one instance of this class across multiple JavaViews - each view's absence record is instance state, not a shared cache.