Merge pull request #215 from avakhrenev/array-equals

Fix FileHash equality
This commit is contained in:
eugene yokota 2019-08-29 12:20:56 -04:00 committed by GitHub
commit f7898a47de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -41,7 +41,14 @@ private final case class FileHash(file: File, override val hash: List[Byte]) ext
override val hashArray: Array[Byte] = hash.toArray
}
private final case class FileHashArrayRepr(file: File, override val hashArray: Array[Byte])
extends HashFileInfo
extends HashFileInfo {
override def hashCode(): Int = (file, java.util.Arrays.hashCode(hashArray)).hashCode()
override def equals(obj: Any): Boolean = obj match {
case that: FileHashArrayRepr =>
this.file == that.file && java.util.Arrays.equals(this.hashArray, that.hashArray)
case _ => false
}
}
@deprecated("Kept for plugin compat, but will be removed in sbt 2.0", "1.3.0")
private final case class FileHashModified(
file: File,