RFR: 8052260: Reference.isEnqueued() spec does not match the long-standing behavior returning true iff it's in the ref queue [v2]
Mandy Chung
mchung at openjdk.java.net
Tue Dec 8 18:53:30 UTC 2020
> `Reference::isEnqueued` method was never implemented as it was initially specified since 1.2. The specification says that it tests if this reference object has been enqueued, but the long-standing behavior is to test if this reference object is in its associated queue, only reflecting the state at the time when this method is executed. The implementation doesn't do what the specification promised, which might cause serious bugs if unnoticed. For example, an application that relies on this method to release critical resources could cause serious performance issues, in particular when this method is misused on Reference objects without an associated queue. `Reference::refersTo(null)` is the better recommended way to test if a Reference object has been cleared.
>
> This proposes to deprecate `Reference::isEnqueued`. Also the spec is updated to match the long-standing behavior.
>
> CSR: https://bugs.openjdk.java.net/browse/JDK-8189386
Mandy Chung has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Merge branch 'master' of https://github.com/openjdk/jdk into isEnqueued
- Merge branch 'master' of https://github.com/openjdk/jdk into isEnqueued
- add suppress warnings
- 8052260: Reference.isEnqueued() spec does not match the long-standing behavior returning true iff it's in the ref queue
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/1684/files
- new: https://git.openjdk.java.net/jdk/pull/1684/files/7549cdc4..b4f9b489
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1684&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1684&range=00-01
Stats: 1325 lines in 35 files changed: 1010 ins; 175 del; 140 mod
Patch: https://git.openjdk.java.net/jdk/pull/1684.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1684/head:pull/1684
PR: https://git.openjdk.java.net/jdk/pull/1684
More information about the core-libs-dev
mailing list