-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make object Disabled extend Disabled #290
Conversation
LGTM if it works. |
A validation involving this pull request is in progress... |
The validator has checked the following projects, tested using dbuild, projects built on top of each other.
✅ The result is: SUCCESS |
I am still getting
Now I think the problem is return type. We should've changed the companion object |
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$; ```
80c3975
to
75c319e
Compare
A validation involving this pull request is in progress... |
The validator has checked the following projects, tested using dbuild, projects built on top of each other.
✅ The result is: SUCCESS |
Confirmed that Cats build works. |
I think this is breaking JSON deserialization in sbt 1.3 nightly.
|
Fixes sbt/sbt#4595 Ref sbt#290 Ref sbt#280 This is bit of an odd one. To keep bincompat and also to fix sbt 0.13 compatibility issue we have made `Disabled` companion object extend `Disabled` type. This actually created a subtle deserialization issue: ``` [error] scala.MatchError: Disabled() (of class sbt.librarymanagement.Disabled$) [error] at sjsonnew.FlatUnionFormats$$anon$5.write(FlatUnionFormats.scala:220) [error] at sjsonnew.JsonWriter.addField(JsonFormat.scala:40) [error] at sjsonnew.JsonWriter.addField$(JsonFormat.scala:37) [error] at sjsonnew.FlatUnionFormats$$anon$5.addField(FlatUnionFormats.scala:208) [error] at sjsonnew.Builder.addField(Builder.scala:43) [error] at sbt.librarymanagement.ModuleIDFormats$$anon$1.write(ModuleIDFormats.scala:46) ``` This is because Contraband generates `flatUnionFormat5[CrossVersion, Disabled, ...]` for all of the subtypes of `CrossVersion`, which uses the runtime type information. Now that `Disabled` object is also in the mix, this created JSON that `CrossVersionFormats` cannot deserialize. This brings the code into src/ so we can write this part manually.
Fixes sbt/sbt#4975 This makes `CrossVersion.Disabled` a stable identifier by reverting `final def` back to `final val`. This is to fix Scala.JS build ``` [error] ScalaJSCrossVersion.scala:34:23: stable identifier required, but sbt.`package`.CrossVersion.Disabled found. [error] case CrossVersion.Disabled => [error] ^ [error] one error found [error] (Compile / compileIncremental) Compilation failed ``` ### notes - sbt#121 added `final val Disabled = sbt.librarymanagement.Disabled` but it was just a companion object - sbt#280 actually made it `final val Disabled = sbt.librarymanagement.Disabled()`, but this broke Cat's build that was calling `CrossVersion.Disabled()` - sbt#290 changed to `final def Disabled = sbt.librarymanagement.Disabled` and `object Disabled extends sbt.librarymanagement.Disabled` - This changes back to `final val Disabled = sbt.librarymanagement.Disabled` (but because we changed the companion object in sbt#290 that's ok)
Ref #280
Ref sbt/contraband#127
This is to workaround bincompat error detected by sbt community build.