You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bartosz Paszkowski (JIRA)" <ji...@apache.org> on 2014/09/22 17:59:35 UTC

[jira] [Created] (LANG-1039) HashCodeBuilder.reflectionHashCode(Object object) returns always the same result for any array

Bartosz Paszkowski created LANG-1039:
----------------------------------------

             Summary: HashCodeBuilder.reflectionHashCode(Object object) returns always the same result for any array
                 Key: LANG-1039
                 URL: https://issues.apache.org/jira/browse/LANG-1039
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.builder.*
    Affects Versions: 3.3.2
            Reporter: Bartosz Paszkowski


HashCodeBuilder.reflectionHashCode(Object object) returns always the same result for any array. The result is 17.

There is no information in javadoc, that this method works in that way.
Maybe it is a bug that sould be fixed?

Example:

{code}
public class HashCodeBuilderTest {
    
    public static void main(String[] args) {
        
        System.out.println(HashCodeBuilder.reflectionHashCode(new double[] {1, 1}));
        System.out.println(HashCodeBuilder.reflectionHashCode(new double[] {2, 2}));
        System.out.println(HashCodeBuilder.reflectionHashCode(new int[] {3, 3}));
        System.out.println(HashCodeBuilder.reflectionHashCode(new int[] {4, 4}));
        System.out.println(HashCodeBuilder.reflectionHashCode(new Long[] {5L, 5L}));
        System.out.println(HashCodeBuilder.reflectionHashCode(new Double[] {null, null}));
        System.out.println(HashCodeBuilder.reflectionHashCode(new Object[] {Boolean.FALSE, 1L, null}));
        
    }
}
{code}

*Output:*
{code}
17
17
17
17
17
17
17
{code}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)