Skip to content
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

Fixes library and compilation warnings, defaults to Scala 2.13 #100

Merged

Conversation

anskarl
Copy link
Contributor

@anskarl anskarl commented May 12, 2020

  • updates Circe to 0.13.0 (only for Scala 2.12 and 2.12)
  • downgrades typesafe config to 1.3.3, since this is the version that Akka HTTP uses
  • excludes scala-library from dependencies
  • upgrades Akka HTTP to 10.1.12
  • for Scala 2.13 dsql uses StringContext.checkLengths and StringContext.processEscapes, since sc.checkLengths and StringContext.treatEscapes are deprecated.
  • default Scala version is now 2.13

For Scala 2.12 and 2.13 there aren't any incompatibilities among library dependencies. For 2.11 there are minor info messages for scala-reflect and jawn-parser:

sbt:scruid> ++2.11.12 evicted
[info] Setting Scala version to 2.11.12 on 1 projects.
[info] Reapplying settings...
[info] Updating ...
[info] Done updating.
[info] Here are other dependency conflicts that were resolved:
[info]  * org.scala-lang:scala-reflect:2.11.12 is selected over 2.11.11
[info]      +- org.typelevel:machinist_2.11:0.6.6                 (depends on 2.11.12)
[info]      +- com.typesafe.scala-logging:scala-logging_2.11:3.9.2 (depends on 2.11.11)
[info]  * org.typelevel:jawn-parser_2.11:0.14.2 is selected over 0.14.1
[info]      +- org.mdedetrich:akka-stream-json_2.11:0.5.0         (depends on 0.14.2)
[info]      +- io.circe:circe-jawn_2.11:0.11.1 ()                 (depends on 0.14.1)
[success]
sbt:scruid> ++2.12.11 evicted
[info] Setting Scala version to 2.12.11 on 1 projects.
[info] Reapplying settings...
[info] Updating ...
[info] Done updating.
[success]
sbt:scruid> ++2.13.2 evicted
[info] Setting Scala version to 2.13.2 on 1 projects.
[info] Reapplying settings...
[info] Set current project to scruid (in build file:/Users/anskarl/work/Personal/dev/scruid/)
[info] Updating ...
[info] Done updating.
[success]

In Scala 2.13 Either is right-biased, therefore .right is deprecated:

[warn] src/main/scala/ing/wbaa/druid/client/DruidClient.scala:155:52: method right in class Either is deprecated (since 2.13.0): Either is now right-biased, use methods directly on Either
[warn]               decode[List[DruidScanResults]](json).right
[warn]                                                    ^
[warn] src/main/scala/ing/wbaa/druid/client/DruidClient.scala:158:40: method right in class Either is deprecated (since 2.13.0): Either is now right-biased, use methods directly on Either
[warn]               decode[List[Json]](json).right
[warn]                                        ^
[warn] src/main/scala/ing/wbaa/druid/client/DruidClient.scala:161:47: method right in class Either is deprecated (since 2.13.0): Either is now right-biased, use methods directly on Either
[warn]               decode[List[DruidResult]](json).right

To overcome this issue, I've added Scala-specific version of a helper function in ing.wbaa.druid.client.CirceDecoders that performs the desired map operation.

Specifically in Scala 2.11:

import io.circe.java8.time._

trait CirceDecoders extends JavaTimeDecoders {

  protected def mapRightProjection[L, R, R1](either: Either[L,R])(f: R => R1): Either[L,R1] = either match {
    case Right(value) => Right(f(value))
    case _ => either.asInstanceOf[Either[L, R1]]
  }

}

Similarly in Scala 2.12:

trait CirceDecoders {

  protected def mapRightProjection[L, R, R1](either: Either[L,R])(f: R => R1): Either[L,R1] = either match {
    case Right(value) => Right(f(value))
    case _ => either.asInstanceOf[Either[L, R1]]
  }

}

While in Scala 2.13 is simply:

trait CirceDecoders {

  protected def mapRightProjection[L, R, R1](either: Either[L,R])(f: R => R1): Either[L,R1] = either.map(f(_))

}

- updates Circe to 0.13.0 (only for Scala 2.12 and 2.12)
- downgrades typesafe config to 1.3.3, since this is the version that Akka HTTP uses
- excludes scala-library from dependencies
- upgrades Akka HTTP to 10.1.12
- for Scala 2.13 dsql uses `StringContext.checkLengths` and `StringContext.processEscapes`, since `sc.checkLengths` and `StringContext.treatEscapes` are deprecated.
- default Scala version is now 2.13

ing-bankGH-97
@anskarl
Copy link
Contributor Author

anskarl commented May 13, 2020

ok I am not going to do any other update, it is ready for review :)

@mmartina mmartina self-requested a review May 13, 2020 12:54
Copy link
Collaborator

@mmartina mmartina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything looks fine to me

@mmartina mmartina merged commit a7bad49 into ing-bank:master May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants