Skip to content

Commit

Permalink
Make dbConfig lazy to fix Scala 3 error
Browse files Browse the repository at this point in the history
However since in Scala 2 "lazy values may not be abstract" we need to
make it non-abstract with ???. Not the nicest thing to do, but ok...
  • Loading branch information
mkurz committed Jul 15, 2023
1 parent 1c60a94 commit 20d9536
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
9 changes: 1 addition & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ lazy val commonSettings = Seq(
scalacOptions ~= (_.filterNot(_ == "-Xfatal-warnings")),
scalaVersion := "2.13.11", // scala213,
crossScalaVersions := Seq("2.13.11", "3.3.0"), // scala213,
scalacOptions ++= {
if (scalaBinaryVersion.value == "3") {
Seq("-source:3.0-migration")
} else {
Nil
}
},
pomExtra := scala.xml.NodeSeq.Empty, // Can be removed when dropping interplay
pomExtra := scala.xml.NodeSeq.Empty, // Can be removed when dropping interplay
developers += Developer(
"playframework",
"The Play Framework Contributors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ object DatabaseConfigProvider {
trait HasDatabaseConfig[P <: BasicProfile] {

/** The Slick database configuration. */
protected val dbConfig: DatabaseConfig[P] // field is declared as a val because we want a stable identifier.
protected lazy val dbConfig: DatabaseConfig[P] =
??? // field is declared as a val because we want a stable identifier. // TODO: Remove "= ???" when dropping Scala 2
/** The Slick profile extracted from `dbConfig`. */
protected final lazy val profile: P = dbConfig.profile // field is lazy to avoid early initializer problems.
@deprecated("Use `profile` instead of `driver`", "2.1")
Expand Down

0 comments on commit 20d9536

Please sign in to comment.