Skip to content

Commit

Permalink
make object Disabled extend Disabled
Browse files Browse the repository at this point in the history
Ref sbt#280

This is to workaround bincompat error detected by sbt community build.

```
[cats] [error] java.lang.NoSuchMethodError: sbt.librarymanagement.CrossVersion$.Disabled()Lsbt/librarymanagement/Disabled$;
```
  • Loading branch information
eed3si9n committed Jan 23, 2019
1 parent 96a3293 commit 75c319e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
7 changes: 0 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,6 @@ lazy val lmCore = (project in file("core"))
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.ArtifactExtra.extension"),
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.ArtifactTypeFilterExtra.types"),

// by mistake we aliased the companion object instead of an instance of Disabled
// but it was aliased as a constant expression, so even if the binary API has changed
// there are no call sites in bytecode because the value got inlined
// also it's wouldn't work so I doubt anyone has made use of it
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.CrossVersionFunctions.Disabled"),
exclude[IncompatibleResultTypeProblem]("sbt.librarymanagement.CrossVersionFunctions.Disabled"),

// contraband issue
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ConfigurationReportLite.copy*"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.UpdateReportLite.copy*"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// DO NOT EDIT MANUALLY
package sbt.librarymanagement
/** Disables cross versioning for a module. */
final class Disabled private () extends sbt.librarymanagement.CrossVersion() with Serializable {
sealed class Disabled private () extends sbt.librarymanagement.CrossVersion() with Serializable {



Expand All @@ -24,7 +24,7 @@ private[this] def copy(): Disabled = {
}

}
object Disabled {
object Disabled extends sbt.librarymanagement.Disabled {

def apply(): Disabled = new Disabled()
}
4 changes: 3 additions & 1 deletion core/src/main/contraband/librarymanagement.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@
"namespace": "sbt.librarymanagement",
"target": "Scala",
"doc": "Disables cross versioning for a module.",
"type": "record"
"type": "record",
"modifier": "sealed",
"parentsCompanion": "sbt.librarymanagement.Disabled"
},
{
"name": "Binary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ final case class ScalaVersion(full: String, binary: String)
private[librarymanagement] abstract class CrossVersionFunctions {

/** Compatibility with 0.13 */
final val Disabled = sbt.librarymanagement.Disabled()
final def Disabled = sbt.librarymanagement.Disabled
final val Binary = sbt.librarymanagement.Binary
final val Constant = sbt.librarymanagement.Constant
final val Full = sbt.librarymanagement.Full
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.8")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.1")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.2")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.9")

scalacOptions += "-language:postfixOps"

0 comments on commit 75c319e

Please sign in to comment.