Integrated: 8256370: Add asserts to Reference.getInactive()
Roman Kennke
rkennke at openjdk.java.net
Tue Nov 17 15:50:02 UTC 2020
On Mon, 16 Nov 2020 17:29:20 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
> 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
This pull request has now been integrated.
Changeset: f2a9d02d
Author: Roman Kennke <rkennke at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/f2a9d02d
Stats: 4 lines in 2 files changed: 3 ins; 0 del; 1 mod
8256370: Add asserts to Reference.getInactive()
Reviewed-by: mchung
-------------
PR: https://git.openjdk.java.net/jdk/pull/1231
More information about the core-libs-dev
mailing list