Class SoftReference

java.lang.Object
java.lang.ref.Reference
java.lang.ref.SoftReference

public class SoftReference extends Reference

A reference the collector keeps while the referent is being used and memory allows, and clears before the process runs out.

This directory is the SUPPORTED API SURFACE, not an implementation: maven/java-runtime compiles it and BytecodeComplianceMojo indexes the result as the set of types an application is allowed to touch. A class implemented in vm/JavaAPI but missing here is therefore invisible to user code -- javac resolves it against the host JDK and the compliance check then rejects it as forbidden API, which is a confusing way to learn a feature was never exported. The bodies are deliberately inert for the same reason the neighbouring stubs are.

  • Constructor Details

    • SoftReference

      public SoftReference(Object ref)
      Creates a new soft reference that refers to the given object.