From 88528a43cba84031de63e4a2e5634f0a09f6a930 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Fri, 6 Dec 2013 15:03:53 +0100 Subject: [PATCH] Fix a few mistakes related to IncOptions.recompileOnMacroDef The 39036e7c2097c5597df5e66a9d4923dd5154a510 introduced `recompileOnMacroDef` option to IncOptions. However, not all necessary logic has been changed. This commit fixes that: * `copy` method does not forget the value of the `recompileOnMacroDef` flag * `productArity` has been increased to match the arity of the class * `productElement` returns the value of `recompileOnMacroDef` flag * `hashCode` and `equals` methods take into account value of `recompileOnMacroDef` flag * fix the name of the key for `recompileOnMacroDef` flag --- compile/inc/src/main/scala/sbt/inc/IncOptions.scala | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/compile/inc/src/main/scala/sbt/inc/IncOptions.scala b/compile/inc/src/main/scala/sbt/inc/IncOptions.scala index 7077d2291..9b366460b 100644 --- a/compile/inc/src/main/scala/sbt/inc/IncOptions.scala +++ b/compile/inc/src/main/scala/sbt/inc/IncOptions.scala @@ -112,14 +112,14 @@ final class IncOptions( apiDumpDirectory: Option[java.io.File] = this.apiDumpDirectory, newClassfileManager: () => ClassfileManager = this.newClassfileManager): IncOptions = { new IncOptions(transitiveStep, recompileAllFraction, relationsDebug, apiDebug, apiDiffContextSize, - apiDumpDirectory, newClassfileManager) + apiDumpDirectory, newClassfileManager, recompileOnMacroDef) } @deprecated("Methods generated for case class will be removed in the future.", "0.13.2") override def productPrefix: String = "IncOptions" @deprecated("Methods generated for case class will be removed in the future.", "0.13.2") - def productArity: Int = 7 + def productArity: Int = 8 @deprecated("Methods generated for case class will be removed in the future.", "0.13.2") def productElement(x$1: Int): Any = x$1 match { @@ -130,6 +130,7 @@ final class IncOptions( case 4 => IncOptions.this.apiDiffContextSize case 5 => IncOptions.this.apiDumpDirectory case 6 => IncOptions.this.newClassfileManager + case 7 => IncOptions.this.recompileOnMacroDef case _ => throw new IndexOutOfBoundsException(x$1.toString()) } @@ -149,7 +150,8 @@ final class IncOptions( acc = Statics.mix(acc, apiDiffContextSize) acc = Statics.mix(acc, Statics.anyHash(apiDumpDirectory)) acc = Statics.mix(acc, Statics.anyHash(newClassfileManager)) - Statics.finalizeHash(acc, 7) + acc = Statics.mix(acc, if (recompileOnMacroDef) 1231 else 1237) + Statics.finalizeHash(acc, 8) } override def toString(): String = scala.runtime.ScalaRunTime._toString(IncOptions.this) @@ -160,7 +162,8 @@ final class IncOptions( transitiveStep == IncOptions$1.transitiveStep && recompileAllFraction == IncOptions$1.recompileAllFraction && relationsDebug == IncOptions$1.relationsDebug && apiDebug == IncOptions$1.apiDebug && apiDiffContextSize == IncOptions$1.apiDiffContextSize && apiDumpDirectory == IncOptions$1.apiDumpDirectory && - newClassfileManager == IncOptions$1.newClassfileManager + newClassfileManager == IncOptions$1.newClassfileManager && + recompileOnMacroDef == IncOptions$1.recompileOnMacroDef })) } //- EXPANDED CASE CLASS METHOD END -// @@ -217,7 +220,7 @@ object IncOptions extends Serializable { private val apiDebugKey = "apiDebug" private val apiDumpDirectoryKey = "apiDumpDirectory" private val apiDiffContextSizeKey = "apiDiffContextSize" - private val recompileOnMacroDefKey = "recompileOnMacroDefKey" + private val recompileOnMacroDefKey = "recompileOnMacroDef" def fromStringMap(m: java.util.Map[String, String]): IncOptions = { // all the code below doesn't look like idiomatic Scala for a good reason: we are working with Java API