PhantomReference
java doc for java 8 and less looks like this:
Phantom reference objects, which are enqueued after the collector determ
Since Java 9, PhantomReference
(PR) are automatically cleared. What you see is the Javadoc change that comes as the result of that change.
Before Java 9, the object referenced by PR was kept alive, even though its get()
would return null
. Therefore, until PR itself is dead, the referent would be technically alive, although you could not acquire the reference to it. The benefits of this behavior are not very clear. Anyhow, PR handling would be the "pre-mortem cleanup".
After Java 9, PR is cleared right before enqueueing (just like other types of weak/soft refs), the referent itself becomes fully dead before PR is processed by application code, which would be the "post-mortem cleanup".