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

provided dependency on scala-compiler leads to runtime crashes of projects using slick #2933

Open
lrytz opened this issue Apr 17, 2024 · 1 comment

Comments

@lrytz
Copy link

lrytz commented Apr 17, 2024

Slick has a "provided" dependency on scala-compiler. This allows macros to compile, for example in ShapedValue (scala.reflect.macros.blackbox is available in scala-reflect).

The getOrElse extension method references ShapedValue. This leads to a java.lang.ClassNotFoundException: scala.reflect.api.Trees$TreeApi at runtime when using that extension method.

Workaround for users is to add libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value.

@lrytz
Copy link
Author

lrytz commented Apr 17, 2024

reproducer: slick-t2933.zip

object Test {
  def main(args: Array[String]): Unit = {
    import slick.jdbc.H2Profile.api._
    println(slick.lifted.Rep.None[Int].getOrElse(0))
  }
}
[info] running Test
Exception in thread "sbt-bg-threads-1" java.lang.NoClassDefFoundError: scala/reflect/api/Trees$TreeApi
	at slick.lifted.AnyOptionExtensionMethods$.getOrElse$extension(ExtensionMethods.scala:219)
	at Test$.main(Test.scala:4)

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

No branches or pull requests

1 participant