[
https://issues.apache.org/jira/browse/LANG-1500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
contextshuffling updated LANG-1500:
-----------------------------------
Description:
Tests in _HashCodeBuilderTest_ depends on _HashCodeBuilder.reflectionHashCode_.
The logic of _reflectionHashCode_ appends the fields returned by
*_java.lang.Class.getDeclaredFields_*. The order of fields being appended will
affect the calculated HashCode.
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--)|https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getDeclaredMethods--]
This affects _HashCodeBuilderTest.testReflectionHashCodeExcludeFields_ and
_HashCodeBuilderTest.testReflectionHierarchyHashCode_ as they depend on the
order of fields returned by the api.
was:
Tests in _HashCodeBuilderTest_ depends on _HashCodeBuilder.reflectionHashCode_.
The logic of _reflectionHashCode_ appends the fields returned by
*_java.lang.Class.getDeclaredFields_*. The order of fields being appended will
affect the calculated HashCode.
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--)|https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getDeclaredMethods--]
This affects HashCodeBuilderTest.testReflectionHashCodeExcludeFields and
HashCodeBuilderTest.testReflectionHierarchyHashCode as they depend on the order
of fields returned by the api.
> Test may fail due to a different order of fields returned by reflection api
> ---------------------------------------------------------------------------
>
> Key: LANG-1500
> URL: https://issues.apache.org/jira/browse/LANG-1500
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.builder.*
> Affects Versions: 3.8, 3.9, 3.8.1
> Reporter: contextshuffling
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Tests in _HashCodeBuilderTest_ depends on
> _HashCodeBuilder.reflectionHashCode_. The logic of _reflectionHashCode_
> appends the fields returned by *_java.lang.Class.getDeclaredFields_*. The
> order of fields being appended will affect the calculated HashCode.
> 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--)|https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getDeclaredMethods--]
>
> This affects _HashCodeBuilderTest.testReflectionHashCodeExcludeFields_ and
> _HashCodeBuilderTest.testReflectionHierarchyHashCode_ as they depend on the
> order of fields returned by the api.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)