[ 
https://issues.apache.org/jira/browse/LANG-1710?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oksana updated LANG-1710:
-------------------------
    Description: 
It is said that overriding classes should overload two methods:  
_#getValue(java.lang.reflect.Field)}_ and 
{_}#accept(java.lang.reflect.Field)}{_}.

But since 3.13.0 getValue(java.lang.reflect.Field)} no longer called in 
{_}appendFieldsIn{_}.
 * System.out.println("An object: " + 
ReflectionToStringBuilder.toString(anObject));
 *  
 * A subclass can control field output by overriding the methods:
 *  
 * <li>\{@link #accept(java.lang.reflect.Field)}</li>
 * <li>\{@link #getValue(java.lang.reflect.Field)}</li>

Also consider to use _trySetAccessible_ instead of 
_AccessibleObject.setAccessible(fields, true);_ and skip not accessible fields.

  was:
It is said that overriding classes should overload to methods  
#getValue(java.lang.reflect.Field)} and #accept(java.lang.reflect.Field)}.

But since 3.13.0 getValue(java.lang.reflect.Field)} no longer called in 
appendFieldsIn.
 * System.out.println("An object: " + 
ReflectionToStringBuilder.toString(anObject));
 * </pre>
 * <p>
 * A subclass can control field output by overriding the methods:
 * </p>
 * <ul>
 * <li>\{@link #accept(java.lang.reflect.Field)}</li>
 * <li>\{@link #getValue(java.lang.reflect.Field)}</li>



Also consider to use trySetAccessible instead of 
AccessibleObject.setAccessible(fields, true); and skip not accessible fields.


> ReflectionToStringBuilder changes in version 3.13.0 has broken the logic for 
> overriding classes
> -----------------------------------------------------------------------------------------------
>
>                 Key: LANG-1710
>                 URL: https://issues.apache.org/jira/browse/LANG-1710
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Oksana
>            Priority: Major
>
> It is said that overriding classes should overload two methods:  
> _#getValue(java.lang.reflect.Field)}_ and 
> {_}#accept(java.lang.reflect.Field)}{_}.
> But since 3.13.0 getValue(java.lang.reflect.Field)} no longer called in 
> {_}appendFieldsIn{_}.
>  * System.out.println("An object: " + 
> ReflectionToStringBuilder.toString(anObject));
>  *  
>  * A subclass can control field output by overriding the methods:
>  *  
>  * <li>\{@link #accept(java.lang.reflect.Field)}</li>
>  * <li>\{@link #getValue(java.lang.reflect.Field)}</li>
> Also consider to use _trySetAccessible_ instead of 
> _AccessibleObject.setAccessible(fields, true);_ and skip not accessible 
> fields.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to