Skip to content

Commit

Permalink
Fix a few mistakes related to IncOptions.recompileOnMacroDef
Browse files Browse the repository at this point in the history
The 39036e7 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
  • Loading branch information
gkossakowski authored and eed3si9n committed Mar 21, 2014
1 parent 337e853 commit 2cf4e0f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions compile/inc/src/main/scala/sbt/inc/IncOptions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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())
}

Expand All @@ -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)
Expand All @@ -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 -//
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2cf4e0f

Please sign in to comment.