Integrated: 8199149: Improve the exception message thrown by VarHandle of unsupported operation
Mandy Chung
mchung at openjdk.org
Thu Jul 20 20:24:53 UTC 2023
On Wed, 19 Jul 2023 00:12:53 GMT, Mandy Chung <mchung at openjdk.org> wrote:
> `VarForm::getMemberName` currently throws UOE with no information if the requested access mode is unsupported. To provide the var handle information, move the access mode check to `VarHandle` so that the exception message can include the var handle information. Changes include:
>
> 1. change `VarHandle::checkAccessModeThenIsDirect` to check if the access mode is unsupported. This check is only needed for direct var handle.
> 2. change `VarHandle::getMethodHandleUncached` to call `getMemberNameOrNull` and throw UOE with an informative exception message if the access mode is unsupported
>
> The error message looks like:
>
> java.lang.UnsupportedOperationException: compareAndSet is not supported for VarHandle[varType=java.lang.String, coord=[class Foo$Goo]]
This pull request has now been integrated.
Changeset: d7b94164
Author: Mandy Chung <mchung at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/d7b941640638b35f9ac1ef11cd6bf6ccb795c29a
Stats: 12 lines in 4 files changed: 7 ins; 0 del; 5 mod
8199149: Improve the exception message thrown by VarHandle of unsupported operation
Reviewed-by: liach, jvernee
-------------
PR: https://git.openjdk.org/jdk/pull/14928
More information about the core-libs-dev
mailing list