You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2015/12/07 16:59:10 UTC

[jira] [Created] (REEF-1047) ConstructorDefImpl.hashCode function should consider `className`

Dongjoon Hyun created REEF-1047:
-----------------------------------

             Summary: ConstructorDefImpl.hashCode function should consider `className`
                 Key: REEF-1047
                 URL: https://issues.apache.org/jira/browse/REEF-1047
             Project: REEF
          Issue Type: Bug
          Components: Tang
            Reporter: Dongjoon Hyun
            Assignee: Dongjoon Hyun


`hashCode` function should consider all fields to distinguish objects. This issue fixes the `hashCode` function of `ConstructorDefImpl` class to consider `className` and `args` together.

{code:title=ConstructorDefImpl.java|borderStyle=solid}
   public int hashCode() {
     final ConstructorArg[] argsSort = getArgs().clone();
     Arrays.sort(argsSort);
-    return Arrays.hashCode(argsSort);
+    int result = Arrays.hashCode(argsSort);
+    result = 31 * result + (this.className == null ? 0 : this.className.hashCode());
+    return result;
   }
{code}



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