Re: RFR: 8199149: Improve the exception message thrown by VarHandle of unsupported operation [v5]

2023-07-20 Thread Jorn Vernee
On Thu, 20 Jul 2023 16:53:14 GMT, Mandy Chung  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]]
>
> Mandy Chung has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   replace other use of AccessMode.values() with valueFromOrdinal

Marked as reviewed by jvernee (Reviewer).

-

PR Review: https://git.openjdk.org/jdk/pull/14928#pullrequestreview-1539700552


Re: RFR: 8199149: Improve the exception message thrown by VarHandle of unsupported operation [v5]

2023-07-20 Thread Mandy Chung
> `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]]

Mandy Chung has updated the pull request incrementally with one additional 
commit since the last revision:

  replace other use of AccessMode.values() with valueFromOrdinal

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/14928/files
  - new: https://git.openjdk.org/jdk/pull/14928/files/f82b2146..cd46a75a

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk=14928=04
 - incr: https://webrevs.openjdk.org/?repo=jdk=14928=03-04

  Stats: 3 lines in 3 files changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/14928.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14928/head:pull/14928

PR: https://git.openjdk.org/jdk/pull/14928