Closed jeanmarc closed 11 months ago
The ticket I raised at lampepfl/dotty was closed with this comment:
The internal compiler API used by compiler plugins has no compatibility guarantee. Compiler plugins must be cross-published against the full Scala version. Using a compiler plugin built against version 3.x.y is not expected to work with any other 3.z.w.
So, my question here is: which Scala / scalac version should I be using for ZIO Profiling v 0.2.1
Looks like I was trying to use too recent versions. With this build.sbt, the application can compile:
ThisBuild / scalaVersion := "3.2.2"
ThisBuild / libraryDependencies += compilerPlugin("dev.zio" %% "zio-profiling-tagging-plugin" % "0.2.1") // (A)
lazy val profiler = project
.in(file("."))
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-profiling" % "0.2.1",
"dev.zio" %% "zio" % "2.0.14"
),
//libraryDependencies += compilerPlugin("dev.zio" %% "zio-profiling-tagging-plugin" % "0.2.1") // (B)
)
Found the acceptable version numbers in the release notes (https://github.com/zio/zio-profiling/releases/tag/v0.2.1)
I am trying to use ZIO Profiler with the compiler plugin as recommended on https://zio.dev/zio-profiling/
sbt version 1.9.7 scala version 3.3.1 ZIO Profiler version 0.2.1 ZIO version 2.0.19
The error I get when rebuilding the project in IntellIJ or sbt command line:
The build fails as soon as I add either of the lines (A) or (B) (not both at the same time) to build.sbt
build.sbt
This is the main application source (no other files in the project)
src/main/scala/Main.scala
Stacktrace of the error (click to expand)
``` scala: ## Exception when compiling 1 sources to /Users/[redacted]/20231201_zio_profiling/target/scala-3.3.1/classes java.lang.NoSuchMethodError: 'java.lang.Object dotty.tools.dotc.ast.Trees$Tree.tpe()' zio.profiling.plugins.TaggingPhase$TaggableTypeTree$.unapply(TaggingPhase.scala:87) zio.profiling.plugins.TaggingPhase$.transformValDef(TaggingPhase.scala:27) dotty.tools.dotc.transform.MegaPhase.goValDef(MegaPhase.scala:1014) dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:245) dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:440) dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:453) dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:453) dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:384) dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:387) dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:442) dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:469) dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:481) dotty.tools.dotc.transform.MegaPhase$MiniPhase.run(MegaPhase.scala:136) dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327) scala.collection.immutable.List.map(List.scala:246) dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331) dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246) scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321) dotty.tools.dotc.Run.runPhases$1(Run.scala:262) dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270) dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279) dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67) dotty.tools.dotc.Run.compileUnits(Run.scala:279) dotty.tools.dotc.Run.compileSources(Run.scala:194) dotty.tools.dotc.Run.compile(Run.scala:179) dotty.tools.dotc.Driver.doCompile(Driver.scala:37) dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88) dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22) sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91) sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:193) scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248) sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183) sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163) sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239) sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163) sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211) sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534) sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534) sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:179) sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:177) sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:463) sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116) sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56) sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52) sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263) sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:418) sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:505) sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:405) sbt.internal.inc.Incremental$.apply(Incremental.scala:171) sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534) sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488) sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332) sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425) sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137) org.jetbrains.jps.incremental.scala.local.SbtCompiler.$anonfun$doCompile$4(SbtCompiler.scala:95) scala.util.Try$.apply(Try.scala:210) org.jetbrains.jps.incremental.scala.local.SbtCompiler.doCompile(SbtCompiler.scala:93) org.jetbrains.jps.incremental.scala.local.SbtCompiler.compile(SbtCompiler.scala:21) org.jetbrains.jps.incremental.scala.local.LocalServer.doCompile(LocalServer.scala:47) org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:25) org.jetbrains.jps.incremental.scala.remote.Main$.compileLogic(Main.scala:208) org.jetbrains.jps.incremental.scala.remote.Main$.$anonfun$handleCommand$1(Main.scala:193) org.jetbrains.jps.incremental.scala.remote.Main$.decorated$1(Main.scala:180) org.jetbrains.jps.incremental.scala.remote.Main$.handleCommand(Main.scala:190) org.jetbrains.jps.incremental.scala.remote.Main$.serverLogic(Main.scala:163) org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:103) org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala) jdk.internal.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:568) com.facebook.nailgun.NGSession.runImpl(NGSession.java:312) com.facebook.nailgun.NGSession.run(NGSession.java:198) ```