From: Olivier Lamy Date: Fri, 7 Oct 2011 10:57:02 +0000 (+0000) Subject: if equals is defined hashCode must be defined too X-Git-Tag: archiva-1.4-M1~49 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4e5ff7650c76d69764556eb72b421b68e4d9248b;p=archiva.git if equals is defined hashCode must be defined too git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1179998 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java index 6d408726d..92205119b 100644 --- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java +++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ArtifactMetadata.java @@ -271,6 +271,23 @@ public class ArtifactMetadata return true; } + @Override + public int hashCode() + { + int result = id != null ? id.hashCode() : 0; + result = 31 * result + ( repositoryId != null ? repositoryId.hashCode() : 0 ); + result = 31 * result + ( namespace != null ? namespace.hashCode() : 0 ); + result = 31 * result + ( project != null ? project.hashCode() : 0 ); + result = 31 * result + ( projectVersion != null ? projectVersion.hashCode() : 0 ); + result = 31 * result + ( version != null ? version.hashCode() : 0 ); + result = 31 * result + ( fileLastModified != null ? fileLastModified.hashCode() : 0 ); + result = 31 * result + (int) ( size ^ ( size >>> 32 ) ); + result = 31 * result + ( md5 != null ? md5.hashCode() : 0 ); + result = 31 * result + ( sha1 != null ? sha1.hashCode() : 0 ); + result = 31 * result + ( whenGathered != null ? whenGathered.hashCode() : 0 ); + return result; + } + @Override public String toString() {