Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
3.14.0
-
None
-
None
-
jdk18
Description
throw java.lang.reflect.InaccessibleObjectException: Unable to make field static final int java.util.HashMap.DEFAULT_INITIAL_CAPACITY accessible: module java.base does not "opens java.util" to unnamed module @37f8bb67
the test code is
@Testpublic void testNestedHashMapToString() {
HashMap<String, HashMap<String, String>> nestedMap = new HashMap<>(); HashMap<String, String> innerMap = new HashMap<>(); innerMap.put("key", "value"); nestedMap.put("nested", innerMap); String result = ReflectionToStringBuilder.toString(nestedMap); // Asserting that the result is not null (NullPointerException is expected) assertNotNull(null, result);}
Attachments
Issue Links
- duplicates
-
LANG-1685 [JDK17] ToStringBuilder.reflectionToString fails with InaccessibleObjectException on java.lang classes
- Open