compat
project: implementation of the compatibility library ;scalafix*
: implementation of the migration tool.binary-compat
: preserve binary compatibility when using the compat library on 2.12
Several levels of contribution are possible!
Create an issue scala-collection-compat/issues.
Embrace diff
s to describe differences between the standard collections and
the new collection:
- xs.toIterator
+ xs.iterator
Even better, instead of providing a diff, you can directly add it as a test case!
-
Fork this repository and create a separate branch;
-
Add a file in the
scalafix/input/src/main/scala/fix/
directory with code that uses the standard collections:
class ToIteratorVsIteratorSrc(xs: Iterable[Int]) {
xs.toIterator
}
- Add a corresponding file in the
scalafix/output/src/main/scala/fix/
directory with the same code but using the new collection:
import scala.collection.compat._
class ToIteratorVsIteratorSrc(xs: Iterable[Int]) {
xs.iterator
}
-
Check that your code example compiles
- run sbt
and then run the following task
compile
;
- run sbt
and then run the following task
-
Format your code with the
scalafmt
sbt task. -
Commit your changes, push your branch to your fork and create a pull request.
Then maybe someone will take over and implement your use case… or maybe you will (see next section)!
Even better, complete the migration tool implementation to support the missing case!
After you have added the missing case (see previous section), run the following sbt task to run the migration tool on the input files and check whether the result matches the expected output files:
> scalafixTests/test
Fix the implementation of the rule (in the rules/src/main/scala/fix/NewCollections.scala
file) until the
tests are green. You can find more help about the scalafix API in its
documentation.
+------------------+-----+-----------------+
| |Input| Output |
| | 2.12| 2.11| 2.12| 2.13|
+------------------+-----+-----+-----+-----+
|data | X | X | X | X |
|input | X | | | |
|output | | X | X | X |
|output212 | | | X | |
|output212+ | | | X | X |
|output213 | | | | X |
|output213-failure | | | | X |
+------------------+-----+-----+-----+-----+
rules: Rule implementations
tests: Scalafix testkit launcher (useful to run a single input file)