When comparing a `MemorySegment` to `MemorySegment.NULL` using `==`, the 
comparison may fail because a segment with address `0` can be created 
independently and will therefore have a different identity from 
`MemorySegment.NULL`. 

This PR adds JavaDocs that explain this issue and warn against using `==` to 
compare segments to `MemorySegment.NULL`.

-------------

Commit messages:
 - Add javadocs about null memorysegments

Changes: https://git.openjdk.org/jdk/pull/30501/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30501&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8381012
  Stats: 12 lines in 1 file changed: 12 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/30501.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30501/head:pull/30501

PR: https://git.openjdk.org/jdk/pull/30501

Reply via email to