I am reading the Java 8 spec and I see this definition for finalizer-reachable:
A finalizer-reachable object can be reached from some finalizable object through some chain of references, but not from any live thread.
What would this look like in code? I don't have an intuition for what something like this would even look like.
In the example code below, when an instance of
Examplebecomes unreachable, the object thatosrefers to will be finalizer-reachable.However, if the
Exampleinstance was no longer eligible for finalization (e.g. because it had been finalized previously and then "resurrected" during finalization), thenoswould not be finalizer-reachable.The "finalizer-reachable" state is about specifying that objects that may be referred to during finalization don't get deleted prematurely. The specification does not state how this should be ensured. I imagine that it would not be possible for Java code (or even native code) to determine whether a specific object was is this state.