[jdk21u-dev] Integrated: 8199149: Improve the exception message thrown by VarHandle of unsupported operation
Rui Li
duke at openjdk.org
Tue Sep 2 17:15:51 UTC 2025
On Thu, 28 Aug 2025 19:28:31 GMT, Rui Li <duke at openjdk.org> wrote:
> A clean backport.
>
> The current UnsupportedOperationException message isn't clear on what method isn't unsupported, as described at [here](https://mail.openjdk.org/pipermail/core-libs-dev/2020-December/072500.html). This change adds the unsupported method name in the exception message.
>
> Low risk. On tip for 2 years.
>
> Tested using the example provided [here](https://mail.openjdk.org/pipermail/core-libs-dev/2020-December/072500.html). Can see the unsupported method name in the exception message. Output:
>
>
> x64 (8318072) % ./build/linux-x86_64-server-release/jdk/bin/java ThereIsABugButWhere.java
> Exception in thread "main" java.lang.UnsupportedOperationException: compareAndSet
> at ThereIsABugButWhere.update(ThereIsABugButWhere.java:22)
> at ThereIsABugButWhere.main(ThereIsABugButWhere.java:26)
>
>
> Jtreg tests are running.
This pull request has now been integrated.
Changeset: 2dc5784b
Author: Rui Li <ruiamzn at amazon.com>
Committer: Victor Rudometov <vrudomet at openjdk.org>
URL: https://git.openjdk.org/jdk21u-dev/commit/2dc5784b51b3c6d8238de1441d656e6c22f3dba9
Stats: 12 lines in 4 files changed: 7 ins; 0 del; 5 mod
8199149: Improve the exception message thrown by VarHandle of unsupported operation
Backport-of: d7b941640638b35f9ac1ef11cd6bf6ccb795c29a
-------------
PR: https://git.openjdk.org/jdk21u-dev/pull/2130
More information about the jdk-updates-dev
mailing list