Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.8, 3.9, 3.8.1
-
None
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--)
This affects HashCodeBuilderTest.testReflectionHashCodeExcludeFields and HashCodeBuilderTest.testReflectionHierarchyHashCode as they depend on the order of fields returned by the api.
Attachments
Issue Links
- links to