On Tue, 14 Jun 2022 15:16:27 GMT, Claes Redestad <[email protected]> wrote:
> Avoid doing MH creation when initializing `StringConcatFactory` by lazily
> initializing to a `@Stable` field instead.
src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 729:
> 727: MethodHandle base = PREPEND_BASE;
> 728: if (base == null) {
> 729: base = PREPEND_BASE = MethodHandles.dropArguments(
I'm curious about this idiom - couldn't this result in the `PREPEND_BASE` field
being assigned twice, with objects that are morally identical, but could have
different identities? (thus violating `@Stable` contract)
-------------
PR: https://git.openjdk.org/jdk/pull/9154