[jdk21u-dev] RFR: 8335638: Calling VarHandle.{access-mode} methods reflectively throws wrong exception

Goetz Lindenmaier goetz at openjdk.org
Wed Sep 10 13:32:43 UTC 2025


On Wed, 3 Sep 2025 04:25:42 GMT, Rui Li <duke at openjdk.org> wrote:

>> A clean backport for https://bugs.openjdk.org/browse/JDK-8335638.
>> 
>> According to [the API specification](https://github.com/openjdk/jdk/blob/d7b941640638b35f9ac1ef11cd6bf6ccb795c29a/src/java.base/share/classes/java/lang/invoke/VarHandle.java#L435-L442), invoking VarHandle.{access-mode} methods reflectively throws an `UnsupportedOperationException`. However, it currently throws exception is an `UnsatisfiedLinkError` instead. (Pretty much what's in the `Problem` section of the [CSR](https://bugs.openjdk.org/browse/JDK-8335805))
>> 
>> Low risk. See Hannes Greule's comment in CSR: https://bugs.openjdk.org/browse/JDK-8335805:
>> 
>>>  it only applies when invoking those methods reflectively - doing that always results in some form of Throwable being thrown - MethodHandle already throws UnsupportedOperationException in the same case - The exception is wrapped by an InvocationTargetException
>> 
>> 
>> Note: I'm not sure if there are any additional processes aside from a pr itself when backporting a fix requiring a CSR to previous versions. Let me know if it requires something else.
>
> The auto updated pr notes asks to create a CSR:
> 
>> Change requires a CSR request matching fixVersion 21.0.9 to be approved (needs to be created)
> 
> I'm not sure if there's anything additional to add on top of https://bugs.openjdk.org/browse/JDK-8335805, aside from marking it with a different version number. If a new CSR jbs is required for tracking, let me know and I'll copy JDK-8335805 to new one.

Hi @rgithubli 
yes, you need to make an extra CSR for the backport. 
There is a manual for this somewhere. You need to make a backport JBS issue, and attach the CSR to that.
The CSR should be identical to the existing one (and state so in a commen) and needs to be approved by Joe Darcy.
Until you have that, I remove the fix request label.

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

PR Comment: https://git.openjdk.org/jdk21u-dev/pull/2144#issuecomment-3274983153


More information about the jdk-updates-dev mailing list