Skip to content

Commit

Permalink
More fixes to get binary compatibility with 1.12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rickynils committed May 22, 2015
1 parent 333307d commit 7ea6a34
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 13 deletions.
47 changes: 39 additions & 8 deletions project/MimaSettings.scala
Expand Up @@ -8,7 +8,9 @@ object MimaSettings {
import mima.plugin.MimaPlugin.mimaDefaultSettings

lazy val settings = mimaDefaultSettings ++ Seq(
previousArtifact := Some("org.scalacheck" % "scalacheck_2.11" % "1.12.3"),
// ScalaCheck 1.12.3 was a bit broken regarding binary compatibility
// (see #165) so we strive for 1.12.4 to be compatible with 1.12.2
previousArtifact := Some("org.scalacheck" % "scalacheck_2.11" % "1.12.2"),
binaryIssueFilters :=
removedPrivateMethods.map(exclude[MissingMethodProblem](_)) ++
newMethods.map(exclude[MissingMethodProblem](_)) ++
Expand All @@ -17,22 +19,51 @@ object MimaSettings {
)

private def newMethods = Seq(
"org.scalacheck.Test#Parameters.toString"
"org.scalacheck.Test#Parameters.toString",
"org.scalacheck.Gen.collect"
)

private def removedPrivateMethods = Seq(
// TestParams was private[scalacheck] in 1.12.3, which was a mistake
"org.scalacheck.Test#Parameters.org$scalacheck$Test$Parameters$_setter_$org$scalacheck$Test$Parameters$$cp_=",
"org.scalacheck.Test#Parameters.TestParams",
"org.scalacheck.Test#Parameters.org$scalacheck$Test$Parameters$$TestParams",
"org.scalacheck.Test#Parameters#TestParams.org$scalacheck$Test$Parameters$_setter_$org$scalacheck$Test$Parameters$$cp_=",
"org.scalacheck.Test#Parameters#TestParams.TestParams"
"org.scalacheck.Arbitrary.org$scalacheck$Arbitrary$$chooseBigInt$1",
"org.scalacheck.Arbitrary.org$scalacheck$Arbitrary$$chooseReallyBigInt$1",
"org.scalacheck.Test.org$scalacheck$Test$$mergeResults$1"
)

private def removedPrivateClasses = Seq(
)

private def otherProblems = Seq(
// The ScalaCheckFramework class has changed in incompatible ways,
// but hopefully this isn't a problem in practice
exclude[FinalClassProblem]("org.scalacheck.ScalaCheckFramework"),
exclude[MissingMethodProblem]("org.scalacheck.ScalaCheckFramework.tests"),
exclude[MissingMethodProblem]("org.scalacheck.ScalaCheckFramework.testRunner"),
exclude[MissingMethodProblem]("org.scalacheck.ScalaCheckFramework.testRunner"),

// Changes to private classes/methods

exclude[MissingClassProblem]("org.scalacheck.util.CmdLineParser$OptVal"),
exclude[MissingClassProblem]("org.scalacheck.util.CmdLineParser$OptVal$"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser#OptMap.update"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser#OptMap.this"),
exclude[MissingTypesProblem]("org.scalacheck.util.CmdLineParser"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$$strVal"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$_setter_$org$scalacheck$util$CmdLineParser$$floatVal_="),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$_setter_$options_="),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$$optVal"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$_setter_$org$scalacheck$util$CmdLineParser$$strVal_="),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.options"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$$OptVal"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$$opt"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$_setter_$org$scalacheck$util$CmdLineParser$$intVal_="),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.parseArgs"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$$intVal"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$$floatVal"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$_setter_$org$scalacheck$util$CmdLineParser$$opt_="),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.org$scalacheck$util$CmdLineParser$_setter_$org$scalacheck$util$CmdLineParser$$optVal_="),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.parseArgs"),
exclude[MissingMethodProblem]("org.scalacheck.util.CmdLineParser.OptMap"),
exclude[MissingClassProblem]("org.scalacheck.util.CmdLineParser$ArgsReader")
)

}
4 changes: 2 additions & 2 deletions src/main/scala/org/scalacheck/Prop.scala
Expand Up @@ -12,7 +12,7 @@ package org.scalacheck
import language.implicitConversions
import language.reflectiveCalls

import util.{Pretty, FreqMap, Buildable, ConsoleReporter}
import util.{Pretty, FreqMap, Buildable, ConsoleReporter, Testable}
import scala.annotation.tailrec

/** Helper class to satisfy ScalaJS compilation. Do not use this directly,
Expand All @@ -23,7 +23,7 @@ class PropFromFun(f: Gen.Parameters => Prop.Result) extends Prop {

@scala.scalajs.js.annotation.JSExportDescendentClasses
@scala.scalajs.js.annotation.JSExportDescendentObjects
trait Prop {
trait Prop extends Testable {

import Prop.{Result, Proof, True, False, Exception, Undecided,
provedToTrue, secure, mergeRes}
Expand Down
5 changes: 2 additions & 3 deletions src/main/scala/org/scalacheck/Test.scala
Expand Up @@ -95,8 +95,7 @@ object Test {
)

// private since we can't guarantee binary compatibility for this one
private lazy val cp = TestParams
private case class TestParams(
private case class cp(
minSuccessfulTests: Int = minSuccessfulTests,
minSize: Int = minSize,
maxSize: Int = maxSize,
Expand All @@ -107,7 +106,7 @@ object Test {
customClassLoader: Option[ClassLoader] = customClassLoader
) extends Parameters

override def toString = cp.toString
override def toString = s"Parameters${cp.toString.substring(2)}"
}

/** Test parameters used by the check methods. Default
Expand Down
7 changes: 7 additions & 0 deletions src/main/scala/org/scalacheck/util/Testable.scala
@@ -0,0 +1,7 @@
package org.scalacheck.util

// TODO: Just kept for binary compatibility. Remove it in 1.13.0

/** Marks a type as testable. This is not used anywhere, and will be removed in
* ScalaCheck 1.13.0. */
trait Testable { }

0 comments on commit 7ea6a34

Please sign in to comment.