-
Bug
-
Resolution: Fixed
-
P3
-
20, 21
-
b02
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8309980 | 21 | Chen Liang | P3 | Resolved | Fixed | b27 |
IndirectVarHandle, added by foreign API to support coordinate mapping, value filtering, etc. does not properly implement VarHandle.isAccessModeSupported. It throws an NPE upon invocation, which is most likely undesired.
Example code in JShell (run with --enable-preview):
```java
var lookup = MethodHandles.lookup();
var arrayVh = MethodHandles.arrayElementVarHandle(int[].class);
var addOne = lookup.bind((IntUnaryOperator) a -> a + 1, "applyAsInt", MethodType.methodType(int.class, int.class));
var patchedArrayVh = MethodHandles.filterCoordinates(arrayVh, 1, addOne);
patchedArrayVh.isAccessModeSupported(VarHandle.AccessMode.GET); // NPE
```
Example code in JShell (run with --enable-preview):
```java
var lookup = MethodHandles.lookup();
var arrayVh = MethodHandles.arrayElementVarHandle(int[].class);
var addOne = lookup.bind((IntUnaryOperator) a -> a + 1, "applyAsInt", MethodType.methodType(int.class, int.class));
var patchedArrayVh = MethodHandles.filterCoordinates(arrayVh, 1, addOne);
patchedArrayVh.isAccessModeSupported(VarHandle.AccessMode.GET); // NPE
```
- backported by
-
JDK-8309980 IndirectVarHandle.isAccessModeSupported throws NPE
-
- Resolved
-
- relates to
-
JDK-8350519 Some FFM VarHandles should return false for isAccessModeSupported
-
- Closed
-
- links to
-
Commit openjdk/jdk21/6711041f
-
Commit openjdk/jdk/75dcc4ef
-
Review openjdk/jdk21/16
-
Review openjdk/jdk/14409
(1 links to)