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

using ReflectionToStringBuilder.toString on the "HashSet"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.14.0
    • None
    • lang.builder.*
    • None

    Description

      when using ReflectionToStringBuilder.toString on the HashSet<String>  it just throw an (java.lang.reflect.InaccessibleObjectException: Unable to make field private static final java.lang.Object java.util.HashSet.PRESENT accessible: module java.base does not "opens java.util" to unnamed module @37f8bb67)

      the test code is
      @Test public void testReflectionHierarchyHashSet() {
      HashSet<String> set = new HashSet<>(); set.add("element1"); set.add("element2"); String result = ReflectionToStringBuilder.toString(set); assertNotNull("Result should not be null", result); assertTrue("Result should contain elements from the HashSet", result.contains("element1") && result.contains("element2")); {color}}
      }

      The test environment is jdk18

      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: