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

Modify ReflectionToStringBuilder to use trySetAccessible and not throw exceptions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      org.apache.commons.lang3.builder.ReflectionToStringBuilder#appendFieldsIn uses following method
      AccessibleObject.setAccessible(fields, true);

      It will throw exception when it is not possible to perform action. I think, better approach - just to skip not accessible fields and report only accessible once. Since Java 9 there is a method trySetAccessible for that.

      https://github.com/apache/commons-lang/pull/1102

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              oksiblack Oksana
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: