You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
update scala3-sbt-bridge from 3.0.0-M2 to 3.0.0, fix LinkageError #SCL-18861 fixed
In Scala 3.0.0-RC1 in sbt-bridge they moved to new compiler interface `xsbti.CompilerInterface2`.
Before Scala 3.0.0-RC1 `xsbt.CompilerClassLoader` was used. It resolved `xsbti.*` classes (e.g. xsbti.AnalysisCallback) to the classes from the CompileServer classloader (more specifically, they were taken from `zincRepackaged` aka `incremental-compiler.jar`).
`compiler-interface.jar` is also included into Scala 3 compiler classpath. But it was simply ignored, because the classes were already loaded by the parent classloader.
After Scala 3.0.0-RC1 `sbt.internal.inc.classpath.DualLoader` is used.
(see sbt.internal.inc.AnalyzingCompiler.compile, see also sbt.internal.inc.AnalyzingCompiler.createDualLoader)
`parentA` loader represents the compiler classloader.
Scala3 compiler uses `xsbti.*` classes directly so it so it's loader needs to resolve the those classes. And they should be resolved to the same classes used in the Compile Server.
Before this commit, the classes were resolved to the `compiler-interface` jar file in the compile classpath itself.
This caused the LinkageError.
To avoid those we delegate all `xsbti.*` classes loading to the SCS classlader.
Closely related links:
- [`[sbt-bridge] Upgrade to CompilerInterface2`](scala/scala3@5185d4d)
- [`[sbt-dotty] Use sbt loader as parent of scala instance loader #10541`](scala/scala3#10541)
0 commit comments