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
Preserve binary compatibility for Factory #115
Conversation
Replace the trait Factory by an abstract type upper-bounded by CanBuildFrom, this way usages of CanBuildFrom can be replaced by Factory without breaking binary compatibility. This has the unfortunate consequence that all methods available on CanBuildFrom are still available on Factory when compiling under old Scala versions, but that seems like a price worth paying for BC.
/cc @mpilquist @xuwei-k Could you check if that fixes the mima issues you got in https://github.com/scodec/scodec/pull/119/files ? |
Also /cc king-of-binary-compatibility @sjrd to tell me if that makes sense :) |
AFAICT, yes, it makes sense. A confirmation from MiMa would be good. |
I think that’s fine because this code will be used to cross-compile with 2.13, and on 2.13 the |
I will add a follow-up PR to add mima as a unit test. This is how you can call mima as a library: https://gist.github.com/MasseGuillaume/8b4ac3a7ec4e0d9fb9be0fb2e03b200c#file-cli-scala-L1 I will create two sbt projects then use BuildInfo to make their classpath available to the unit test. |
@smarter Here you go: MasseGuillaume@945d1c8 You can cherry-pick this commit and add some tests. |
@MasseGuillaume Thanks, done! |
Maybe something needs to be done to run the added tests on the CI too? |
Awesome guys! |
* @tparam A Type of elements (e.g. `Int`, `Boolean`, etc.) | ||
* @tparam C Type of collection (e.g. `List[Int]`, `TreeMap[Int, String]`, etc.) | ||
*/ | ||
type Factory[-A, +C] <: CanBuildFrom[Nothing, A, C] // Ideally, this would be an opaque type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a new chapter in this story: #275 |
bump Scala version to 2.13.3
Replace the trait Factory by an abstract type upper-bounded by
CanBuildFrom, this way usages of CanBuildFrom can be replaced by Factory
without breaking binary compatibility.
This has the unfortunate consequence that all methods available on
CanBuildFrom are still available on Factory when compiling under old
Scala versions, but that seems like a price worth paying for BC.