From 4f2933d3646af1bb7218b5592991a94b19447fb6 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 20 Feb 2018 18:50:22 +1000 Subject: [PATCH] Cache the hashCode of Configuration I noticed this was showing up in profiles when SBT's task engine was using Keys, etc (that contain Configurations) in HashMap's. Let's cache it instead. I don't think there is a need to use a lazy val for this, we can compute it eagerly. --- core/src/main/scala/sbt/librarymanagement/Configuration.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/scala/sbt/librarymanagement/Configuration.scala b/core/src/main/scala/sbt/librarymanagement/Configuration.scala index 9f642efd6..2306efdda 100644 --- a/core/src/main/scala/sbt/librarymanagement/Configuration.scala +++ b/core/src/main/scala/sbt/librarymanagement/Configuration.scala @@ -31,7 +31,7 @@ final class Configuration private[sbt] ( (this.transitive == x.transitive) case _ => false } - override def hashCode: Int = { + override val hashCode: Int = { 37 * (37 * (37 * (37 * (37 * (37 * (17 + id.##) + name.##) + description.##) + isPublic.##) + extendsConfigs.##) + transitive.##) } override def toString: String = {