You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2019/11/24 02:54:00 UTC

[jira] [Updated] (LANG-1501) Test may fail due to a different order of fields returned by reflection API

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

Gary D. Gregory updated LANG-1501:
----------------------------------
    Summary: Test may fail due to a different order of fields returned by reflection API  (was: Test may fail due to a different order of fields returned by reflection api)

> Test may fail due to a different order of fields returned by reflection API
> ---------------------------------------------------------------------------
>
>                 Key: LANG-1501
>                 URL: https://issues.apache.org/jira/browse/LANG-1501
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>            Reporter: contextshuffling
>            Priority: Minor
>             Fix For: 3.10
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Tests in MultilineRecursiveToStringStyleTest.java, RecursiveToStringStyleTest.java, ToStringBuilderTest.java depends on ReflectionToStringBuilder.appendFieldsIn. It appends the fields returned by java.lang.Class.getDeclaredFields. 
> However, java.lang.Class.getDeclaredFields does not guarantee any specific order and thus, test can fail if the order is different, (i.e., it generates a different hash code). "The elements in the returned array are not sorted and are not in any particular order" (reference: https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getDeclaredMethods--)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)