Browse Source

checkstyle + align hashCode with equals

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@471287 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
f79a46b2d4
1 changed files with 11 additions and 9 deletions
  1. +11
    -9
      src/main/org/apache/tools/ant/taskdefs/Manifest.java

+ 11
- 9
src/main/org/apache/tools/ant/taskdefs/Manifest.java View File

@@ -151,12 +151,13 @@ public class Manifest {


/** /**
* @see java.lang.Object#hashCode * @see java.lang.Object#hashCode
* @return a hashcode based on the key and values.
*/ */
public int hashCode() { public int hashCode() {
int hashCode = 0; int hashCode = 0;


if (name != null) { if (name != null) {
hashCode += name.hashCode();
hashCode += getKey().hashCode();
} }


hashCode += values.hashCode(); hashCode += values.hashCode();
@@ -164,7 +165,9 @@ public class Manifest {
} }


/** /**
* @param rhs the object to check for equality.
* @see java.lang.Object#equals * @see java.lang.Object#equals
* @return true if the key and values are the same.
*/ */
public boolean equals(Object rhs) { public boolean equals(Object rhs) {
if (rhs == null || rhs.getClass() != getClass()) { if (rhs == null || rhs.getClass() != getClass()) {
@@ -684,20 +687,16 @@ public class Manifest {


/** /**
* @see java.lang.Object#hashCode * @see java.lang.Object#hashCode
* @return a hash value based on the attributes.
*/ */
public int hashCode() { 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 * @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) { public boolean equals(Object rhs) {
if (rhs == null || rhs.getClass() != getClass()) { if (rhs == null || rhs.getClass() != getClass()) {
@@ -992,6 +991,7 @@ public class Manifest {


/** /**
* @see java.lang.Object#hashCode * @see java.lang.Object#hashCode
* @return a hashcode based on the version, main and sections.
*/ */
public int hashCode() { public int hashCode() {
int hashCode = 0; int hashCode = 0;
@@ -1007,6 +1007,8 @@ public class Manifest {


/** /**
* @see java.lang.Object#equals * @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) { public boolean equals(Object rhs) {
if (rhs == null || rhs.getClass() != getClass()) { if (rhs == null || rhs.getClass() != getClass()) {


Loading…
Cancel
Save