We are trying to migrate from Scala 2.12.8 to 2.13.0-RC1 for several twitter libraries, util/scrooge/finagle/twitter-server/finatra, currently finished util.
(Moses did the last experiment to try out 2.13.0-M4 for util here before.) We would like to share some feedback about this time migration:
- CanBuild[A, C] has been replaced by Factory[A, C] + BuildFrom[From, A, C].
We have troubles to construct a Builder[A, Seq[A]] from scratch. If we use Factory, there’s no implicit SeqFactory can be summoned but only ArrayFactory, however, we did notice there is an implicit iterableFactory, but failed to call it. If we use BuildFrom, it seems BuildFrom cannot build from
+=:became final, also
enqueuemethod does not accept varargs. Can we add the backward compatible APIs here?
Seq.unapply() cannot infer types anymore; users need to add annotations, is this intentional?
We have many many many
toSeqs need to be added in order to compile due to the new collection lib change. We could change our library APIs to take immutable Seq, but it won’t help a lot for our users’ existing code. Does it make sense to have some implicit methods in the collection lib to do the transform?
scala-collection-compat migration tool seems a bit limited at this time; it fixes most
breakOutchanges and JavaConverters migration. But to make our code compile with 2.13.0-RC1, we still need manual work to transform between the collection.Seq with immutable.Seq, adding many
toSeqto the ArrayBuffer and other structures used to implement Seq.
Migration tool rewrites:
We would like to hear more insights about these API changes, and suggestions to help us migrate in the future. And we will continue this thread to add more observations when finish migrating other libraries.