A list of things I changed in a Scala 2->3 upgrade

  • implicit parameter -> using variables
    • explicitly passed-in parameters will be passed like this: foo(using someVariable)
  • implicit variables -> given variables
  • implicit class -> extension
  • Pureconfig
    • com.github.pureconfig:pureconfig_2.13 -> com.github.pureconfig:pureconfig-generic-scala3_3
    • implicit def hint[T] = ... -> given [T]: ProductHint[T] = ...
    • Add given ConfigReader[MyConf] = deriveReader
  • Mockito
    • remove org.mockito:mockito-scala because it doesn’t support scala3
    • mock[SomeClass] -> mock(classOf[SomeClass])
  • Scalastyle -> Scalafix
    • scalastyle-config.xml -> .scalafix.conf
      • RegexChecker -> DisableSyntax.regex
    • scalastyle:ignore someRule -> scalafix:ok someRule
  • scalafmt: upgrade runner.dialect to scala3
  • Scala compiler options: use this one
  • Do organize imports for all classes in intellij
  • Upgrade all 3rd party libraries from 2.13 to 3, if there is a scala3 version of it

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.