From f79a46b2d4fdac96690d75dff414dc846d4a9095 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Sat, 4 Nov 2006 22:42:00 +0000 Subject: [PATCH] checkstyle + align hashCode with equals git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@471287 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/taskdefs/Manifest.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/src/main/org/apache/tools/ant/taskdefs/Manifest.java index 3ba2333a1..3acdced48 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java +++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java @@ -151,12 +151,13 @@ public class Manifest { /** * @see java.lang.Object#hashCode + * @return a hashcode based on the key and values. */ public int hashCode() { int hashCode = 0; if (name != null) { - hashCode += name.hashCode(); + hashCode += getKey().hashCode(); } hashCode += values.hashCode(); @@ -164,7 +165,9 @@ public class Manifest { } /** + * @param rhs the object to check for equality. * @see java.lang.Object#equals + * @return true if the key and values are the same. */ public boolean equals(Object rhs) { if (rhs == null || rhs.getClass() != getClass()) { @@ -684,20 +687,16 @@ public class Manifest { /** * @see java.lang.Object#hashCode + * @return a hash value based on the attributes. */ public int hashCode() { - int hashCode = 0; - - if (name != null) { - hashCode += name.hashCode(); - } - - hashCode += attributes.hashCode(); - return hashCode; + return attributes.hashCode(); } /** * @see java.lang.Object#equals + * @param rhs the object to check for equality. + * @return true if the attributes are the same. */ public boolean equals(Object rhs) { if (rhs == null || rhs.getClass() != getClass()) { @@ -992,6 +991,7 @@ public class Manifest { /** * @see java.lang.Object#hashCode + * @return a hashcode based on the version, main and sections. */ public int hashCode() { int hashCode = 0; @@ -1007,6 +1007,8 @@ public class Manifest { /** * @see java.lang.Object#equals + * @param rhs the object to check for equality. + * @return true if the version, main and sections are the same. */ public boolean equals(Object rhs) { if (rhs == null || rhs.getClass() != getClass()) {