-
CSR
-
Resolution: Approved
-
P3
-
None
-
source, binary
-
minimal
-
This method is declared in a sealed class that doesn't have any non-sealed subclass that users can extend, so it has no risk of clashing.
-
Java API
-
SE
Summary
Remove the final modifier from the method VarHandle::isAccessModeSupported
to allow the implementation subclass to override and provide an alternative implementation.
Problem
VarHandle::isAccessModeSupported anticipates a VarHandle's VarForm to have implementation member names, which doesn't necessarily exist for non-direct VarHandle implementations. Thus IndirectVarHandle::isAccessModeSupported throws NullPointerException on its invocation.
Solution
Make VarHandle::isAccessModeSupported
non-final to allow subclasses to override and provide a subclass-specific implementation.
Specification
@@ -2120,7 +2118,7 @@ public abstract sealed class VarHandle implements Constable
* @return {@code true} if the given access mode is supported, otherwise
* {@code false}.
*/
- public final boolean isAccessModeSupported(AccessMode accessMode) {
+ public boolean isAccessModeSupported(AccessMode accessMode) {
return vform.getMemberNameOrNull(accessMode.ordinal()) != null;
}
- csr of
-
JDK-8309980 IndirectVarHandle.isAccessModeSupported throws NPE
-
- Resolved
-