-
CSR
-
Resolution: Approved
-
P4
-
None
-
behavioral
-
low
-
-
Java API
-
SE
Summary
Some VarHandle
s created by the Foreign Function & Memory (FFM) API now consistently return false
on VarHandle::isAccessModeSupported
for access modes that they do not support.
Problem
Some VarHandle
s returned by FFM APIs, including MemoryLayout::varHandle
, arrayElementVarHandle
, and ValueLayout::varHandle
, may or may not support access modes other than plain get
and set
, such as getOpaque
setVolatile
, depending on the byte alignment property of the layout and the path elements passed to construct the handle.
When these access modes are not supported, the implementation methods currently simply throw an UnsupportedOperationException
. However, they do not correctly report this lack of support in VarHandle::isAccessModeSupported
.
Solution
Update those VarHandle
implementations to return false
upon isAccessModeSupported
query for non-plain access modes when they are not supported by these VarHandle
.
Specification
No change. The fact that some access modes are not supported by all var handles created by FFM is already documented here:
As such, this change is purely behavioral.
- csr of
-
JDK-8350118 Simplify the layout access VarHandle
-
- Resolved
-
- relates to
-
JDK-8307508 IndirectVarHandle.isAccessModeSupported throws NPE
-
- Resolved
-