[jdk21u-dev] RFR: 8199149: Improve the exception message thrown by VarHandle of unsupported operation

Rui Li duke at openjdk.org
Thu Aug 28 19:33:01 UTC 2025


A clean backport.

Tested using the example provided [here](https://mail.openjdk.org/pipermail/core-libs-dev/2020-December/072500.html). Can see 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.

-------------

Commit messages:
 - Backport d7b941640638b35f9ac1ef11cd6bf6ccb795c29a

Changes: https://git.openjdk.org/jdk21u-dev/pull/2130/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk21u-dev&pr=2130&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8199149
  Stats: 12 lines in 4 files changed: 7 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk21u-dev/pull/2130.diff
  Fetch: git fetch https://git.openjdk.org/jdk21u-dev.git pull/2130/head:pull/2130

PR: https://git.openjdk.org/jdk21u-dev/pull/2130


More information about the jdk-updates-dev mailing list