Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.4.0
-
None
Description
ChecksumByteBufferImpl's static initializer fails with:
ava.lang.reflect.InaccessibleObjectException: Unable to make field boolean java.nio.ByteBuffer.isReadOnly accessible: module java.base does not "opens java.nio" to unnamed module @46d56d67 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at org.apache.hadoop.ozone.common.ChecksumByteBufferImpl.<clinit>(ChecksumByteBufferImpl.java:51)
This exception appears with Java 17 and above as I tested it, it works for Java 9 and 11, however there is a way (according to the comment in the initializer) in Java 9 which we can use and which is identical to what we are doing with setting the field in Java 8.
So I propose to use that from Java 9, and do not try to set the isReadOnly field accessible after Java 8.
Attachments
Issue Links
- links to