[
https://issues.apache.org/jira/browse/LANG-1711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763413#comment-17763413
]
Elliotte Rusty Harold commented on LANG-1711:
---------------------------------------------
We should be able to emulate that method in Java 8 by catching the relevant
exception.
> Modify ReflectionToStringBuilder to use trySetAccessible and not throw
> exceptions
> ---------------------------------------------------------------------------------
>
> Key: LANG-1711
> URL: https://issues.apache.org/jira/browse/LANG-1711
> Project: Commons Lang
> Issue Type: Improvement
> Reporter: Oksana
> Priority: Major
>
> 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]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)