Shilun Fan created HADOOP-19726:
-----------------------------------

             Summary: Add JDK 17 compile options for maven-surefire-plugin in 
hadoop-tos module
                 Key: HADOOP-19726
                 URL: https://issues.apache.org/jira/browse/HADOOP-19726
             Project: Hadoop Common
          Issue Type: Improvement
          Components: hadoop-tos
    Affects Versions: 3.5.0
            Reporter: Shilun Fan
            Assignee: Shilun Fan


Currently, the {{hadoop-tos}} module does not have the JDK 17 compile options 
configured for the {{{}maven-surefire-plugin{}}}, which causes the following 
error during unit test execution:
{code:java}
java.lang.IllegalStateException: Failed to set environment variable     at 
org.apache.hadoop.fs.tosfs.util.TestUtility.setSystemEnv(TestUtility.java:120)  
     at 
org.apache.hadoop.fs.tosfs.object.ObjectStorageTestBase.setUp(ObjectStorageTestBase.java:59)
 at java.base/java.lang.reflect.Method.invoke(Method.java:569)   at 
java.base/java.util.ArrayList.forEach(ArrayList.java:1511)   at 
java.base/java.util.ArrayList.forEach(ArrayList.java:1511)Caused by: 
java.lang.reflect.InaccessibleObjectException: Unable to make field private 
final java.util.Map java.util.Collections$UnmodifiableMap.m accessible: module 
java.base does not "opens java.util" to unnamed module @69eee410     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.fs.tosfs.util.TestUtility.setSystemEnv(TestUtility.java:116)  
     ... 4 more
 {code}
This error occurs due to the module system restrictions in JDK 17, where 
reflection cannot access private fields in the 
java.util.Collections$UnmodifiableMap class.

 

To resolve this issue, JDK 17 compile options have been added to ensure the 
maven-surefire-plugin works correctly in a JDK 17 environment. This PR adds the 
necessary compile options for maven-surefire-plugin to support JDK 17, fixing 
the error and ensuring that unit tests can run smoothly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to