RFR: 8256370: Add asserts to Reference.getInactive()
Roman Kennke
rkennke at openjdk.java.net
Mon Nov 16 17:34:09 UTC 2020
A follow-up to JDK-8256106, this is adding two asserts to check that the API is used as it should be, i.e. only on inactive FinalReferences. Also, in Finalizer, where getInactive() is used, there is a null-check. The GC must never clean the referent, and Java code doesn't clean it either, it would be a bug if we ever see null there. I think it's better to fail there (with assert or NPE) when that happens instead of silently accepting it.
Testing:
- [x] tier1
- [x] tier2
-------------
Commit messages:
- 8256370: Add asserts to Reference.getInactive()
Changes: https://git.openjdk.java.net/jdk/pull/1231/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1231&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8256370
Stats: 4 lines in 2 files changed: 3 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/1231.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1231/head:pull/1231
PR: https://git.openjdk.java.net/jdk/pull/1231
More information about the core-libs-dev
mailing list