The spec for NewWeakGlobalRef initially states:
Returns NULL if obj refers to null, or if obj was a weak global reference, or if the VM runs out of memory.
However, the actual "returns" section states:
May return NULL if:
obj refers to null
the system has run out of memory
obj was a weak global reference and has already been garbage collected
The part "and has already been garbage collected" is missing from the initial text and may cause confusion.
The "returns" section was updated by JDK-8188066 but the expanded information was not also added to the main text.