[WIP] Add support for Scala 2.13-M4 #391
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the process of making the new collections as compatible as possible with the old collections, I’ve migrated this project to find out where the incompatibilities are.
Most of the changes shown in the diff have been automatically applied by a scalafix rewrite rule. In some cases I had to take decisions or just rewrite things differently. I’m using the scala-collection-compat library to make 2.13’s API available on 2.12 and prior Scala versions. I use two specific source directories, for 2.13 on one side, and for 2.12 and prior Scala versions on the other side, to implement a custom collection (
ArrayListBuilder
).The changes automatically handled by the rewrite rule are the following:
Traversable
withIterable
,iterator()
andnewBuilder()
,Stream#append
withStream#lazyAppendAll
.The areas that are not handled by the rewrite rule are the following:
CanBuildFrom
usage (here, replaced withFactory
),scala.Seq
usage (here, I chose the conservative approach that consists in usingscala.collection.Seq
, which is the same on 2.12 and 2.13, instead ofscala.Seq
, which expands toimmutable.Seq
on 2.13),ArrayListBuilder
).