On Fri, 20 Jun 2025 13:50:08 GMT, Doug Lea <[email protected]> wrote:
>> src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
>> line 86:
>>
>>> 84: * }
>>> 85: * // ... and so on
>>> 86: * }}</pre>
>>
>> I wonder if this should be convert to a `{@snippet ..}` and have it handle
>> the checked exceptions thrown by findVarHandle. I'm just thinking of someone
>> seeing VarHandle usage for first time, then reporting a bug that the example
>> doesn't compile.
>
> I made it compilable, in the lest ugly way I could think of. Not sure if
> either or both should now be snippets? @pavelrappo any thoughts?
Up to you. Currently, in addition to what `<pre>{@code ...}</pre>` does, a
snippet provides a copy-paste facility. Other than that, there isn't much it
would buy you here.
In JDK 25 even pre-code is highlighted [^1]:
https://cr.openjdk.org/~hannesw/8348282/api.00/java.base/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.html
[^1]: https://mail.openjdk.org/pipermail/javadoc-dev/2025-April/008809.html
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25880#discussion_r2159123099