Integrated: 8361497: Scoped Values: orElse and orElseThrow do not access the cache
Andrew Haley
aph at openjdk.org
Mon Jul 21 17:08:31 UTC 2025
On Mon, 7 Jul 2025 16:13:08 GMT, Andrew Haley <aph at openjdk.org> wrote:
> Neither `ScopedValue.orElse` nor `ScopedValue.orElseThrow` consult the cache when searching for a binding. Neither do they update the cache when a binding is found.
> While this issue does not affect spec compliance, it is surprising to users that `x.orElse(other)` should be slower than `x.isBound ? x.get() : other`.
This pull request has now been integrated.
Changeset: 9dd93c6a
Author: Andrew Haley <aph at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/9dd93c6a2c5fb4c3a9f2a063a7ab402f9292ad03
Stats: 100 lines in 2 files changed: 85 ins; 0 del; 15 mod
8361497: Scoped Values: orElse and orElseThrow do not access the cache
Reviewed-by: alanb
-------------
PR: https://git.openjdk.org/jdk/pull/26164
More information about the core-libs-dev
mailing list