[jdk21u-dev] RFR: 8199149: Improve the exception message thrown by VarHandle of unsupported operation
duke
duke at openjdk.org
Tue Sep 2 02:37:49 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.
@rgithubli
Your change (at version ab174cdc439baf357f82e506f7ca7273d31a1a01) is now ready to be sponsored by a Committer.
-------------
PR Comment: https://git.openjdk.org/jdk21u-dev/pull/2130#issuecomment-3243601671
More information about the jdk-updates-dev
mailing list