scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.83k stars 1.05k forks source link

Cannot build project in Intellij IDEA with 3.3.3 and 3.4.0 versions #20047

Closed GeorgeII closed 6 months ago

GeorgeII commented 6 months ago

Compiler version

Scala: 3.3.3 and 3.4.0 IDE: Intellij IDEA Community Edition: Build #IC-231.9011.34, built on May 16, 2023 OS: Windows 10 Pro 10.0.19045 Build 19045

Minimized code

I used Scala 3.3.1 and it worked just fine when I pressed "Build Project" (Ctrl + F9) button in Intellij IDEA. When I change Scala version to 3.3.3 (the same goes for 3.4.0), "Build Project" button gives me a compiler error.

Output

scalac: Error: dotty.tools.dotc.core.Contexts$FreshContext.setSbtCallback(Lxsbti/AnalysisCallback;)Ldotty/tools/dotc/core/Contexts$FreshContext;
java.lang.NoSuchMethodError: dotty.tools.dotc.core.Contexts$FreshContext.setSbtCallback(Lxsbti/AnalysisCallback;)Ldotty/tools/dotc/core/Contexts$FreshContext;
     at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:61)
     at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
     at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
     at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:48)
     at org.jetbrains.jps.incremental.scala.local.LocalServer.doCompile(LocalServer.scala:47)
     at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:25)
     at org.jetbrains.jps.incremental.scala.remote.Main$.compileLogic(Main.scala:198)
     at org.jetbrains.jps.incremental.scala.remote.Main$.$anonfun$handleCommand$1(Main.scala:185)
     at org.jetbrains.jps.incremental.scala.remote.Main$.decorated$1(Main.scala:175)
     at org.jetbrains.jps.incremental.scala.remote.Main$.handleCommand(Main.scala:182)
     at org.jetbrains.jps.incremental.scala.remote.Main$.serverLogic(Main.scala:158)
     at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:98)
     at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
     at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.base/java.lang.reflect.Method.invoke(Method.java:566)
     at com.facebook.nailgun.NGSession.runImpl(NGSession.java:312)
     at com.facebook.nailgun.NGSession.run(NGSession.java:198)

Expectation

My project should be built

GeorgeII commented 6 months ago

Created an issue in IntelliJ IDEA tracker: https://youtrack.jetbrains.com/issue/IDEA-350317/Project-cannot-be-built-with-Scala-3.3.2-3.3.3-and-3.4.0-versions

WojciechMazur commented 6 months ago

The setSbtCallback was renamed in 2458b8f48d175b67fd4aac5caa0b27325e0db8b3 , seems like they might be using uncompatible versions of bridge and compiler? These thing seems like the issue with the classpath

However, when checking this out I've found 721888d95f599dbc6aa38a9fe4c72ae545ebc194 which adds additional CompileProgrss parameter to the CompilerBridgeDriver.run isn't that a breaking change? This part is in Java so I shall remain the stable API @bishabosha

GeorgeII commented 6 months ago

Updating IntelliJ IDEA to 233.15026.9 helped, thank you!

75ACOL commented 5 months ago

Thanks, I solved it by upgrading IntelliJ IDEA.