Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1740

using ReflectionToStringBuilder.toString on the "HashMap"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.14.0
    • None
    • lang.builder.*
    • 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

          Activity

            People

              Unassigned Unassigned
              sustech-whl Wang Hailong
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: