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

Unsupported Scala 2.11 (2.11.12) #5561

Closed
danjaredg opened this issue Aug 17, 2023 · 14 comments
Closed

Unsupported Scala 2.11 (2.11.12) #5561

danjaredg opened this issue Aug 17, 2023 · 14 comments
Milestone

Comments

@danjaredg
Copy link

If you create a project (maven or sbt) with versión 2.11.12, de auto complementation not working, de bloop.log show the error:

Exception in thread "pool-36-thread-1" java.lang.NoClassDefFoundError: scala/meta/shaded/internal/fastparse/ParserInputSource
at scala.meta.internal.tokenizers.ScalametaTokenizer.scala$meta$internal$tokenizers$ScalametaTokenizer$$uncachedTokenize(ScalametaTokenizer.scala:22)
at scala.meta.internal.tokenizers.ScalametaTokenizer$$anonfun$tokenize$1.apply(ScalametaTokenizer.scala:17)
at scala.meta.internal.tokenizers.ScalametaTokenizer$$anonfun$tokenize$1.apply(ScalametaTokenizer.scala:17)
at scala.collection.concurrent.TrieMap.getOrElseUpdate(TrieMap.scala:901)
at scala.meta.internal.tokenizers.ScalametaTokenizer.tokenize(ScalametaTokenizer.scala:17)
at scala.meta.internal.tokenizers.ScalametaTokenizer$$anon$2.apply(ScalametaTokenizer.scala:332)
at scala.meta.tokenizers.Api$XtensionTokenizeDialectInput.tokenize(Api.scala:25)
at scala.meta.tokenizers.Api$XtensionTokenizeInputLike.tokenize(Api.scala:14)
at scala.meta.internal.parsers.ScannerTokens$.apply(ScannerTokens.scala:873)
at scala.meta.internal.parsers.ScalametaParser.(ScalametaParser.scala:33)
at scala.meta.parsers.Parse$$anon$1.apply(Parse.scala:35)
at scala.meta.parsers.Api$XtensionParseDialectInput.parse(Api.scala:25)
at scala.meta.internal.semanticdb.scalac.ParseOps$XtensionCompilationUnitSource.toSource(ParseOps.scala:17)
at scala.meta.internal.semanticdb.scalac.TextDocumentOps$XtensionCompilationUnitDocument.toTextDocument(TextDocumentOps.scala:206)
at scala.meta.internal.pc.SemanticdbTextDocumentProvider.textDocument(SemanticdbTextDocumentProvider.scala:54)
at scala.meta.internal.pc.ScalaPresentationCompiler$$anonfun$semanticdbTextDocument$1.apply(ScalaPresentationCompiler.scala:350)
at scala.meta.internal.pc.ScalaPresentationCompiler$$anonfun$semanticdbTextDocument$1.apply(ScalaPresentationCompiler.scala:345)
at scala.meta.internal.pc.CompilerAccess.withSharedCompiler(CompilerAccess.scala:146)
at scala.meta.internal.pc.CompilerAccess$$anonfun$1.apply(CompilerAccess.scala:92)
at scala.meta.internal.pc.CompilerAccess$$anonfun$onCompilerJobQueue$1.apply$mcV$sp(CompilerAccess.scala:231)
at scala.meta.internal.pc.CompilerJobQueue$Job.run(CompilerJobQueue.scala:152)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.ClassNotFoundException: scala.meta.shaded.internal.fastparse.ParserInputSource
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 24 more

@tgodzik tgodzik transferred this issue from scalameta/metals-vscode Aug 17, 2023
@tgodzik
Copy link
Contributor

tgodzik commented Aug 17, 2023

Thanks for reporting! Looks like shading is not working for Scala 2.11.12 and since we no longer test for it, this never got detected.

@tgodzik
Copy link
Contributor

tgodzik commented Aug 17, 2023

You can switch the Metals version to a previous one for the time being.

@franekfm
Copy link

@tgodzik this does NOT work for BSP neither - not only for BLOOP.

  1. whole IntelliSense is not working, perhaps for the same reason.
  2. Organize imports stopped working as well:
[Error - 2:57:15 PM] Request textDocument/codeAction failed.
  Message: Internal error.
  Code: -32603
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Unsupported scala version 2.11
  at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
  at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
  at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:661)
  at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:646)
  at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
  at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990)
  at scala.meta.internal.metals.CancelTokens$.$anonfun$future$1(CancelTokens.scala:40)
  at scala.meta.internal.metals.CancelTokens$.$anonfun$future$1$adapted(CancelTokens.scala:38)
  at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:484)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Unsupported scala version 2.11
  at scalafix.interfaces.Scalafix.fetchAndClassloadInstance(Scalafix.java:117)
  at scalafix.interfaces.Scalafix.fetchAndClassloadInstance(Scalafix.java:85)
  at scala.meta.internal.metals.ScalafixProvider.$anonfun$getScalafix$2(ScalafixProvider.scala:440)
  at scala.util.Try$.apply(Try.scala:210)
  at scala.meta.internal.metals.ScalafixProvider.$anonfun$getScalafix$1(ScalafixProvider.scala:440)
  at scala.meta.internal.metals.StatusBar.trackBlockingTask(StatusBar.scala:48)
  at scala.meta.internal.metals.ScalafixProvider.getScalafix(ScalafixProvider.scala:438)
  at scala.meta.internal.metals.ScalafixProvider.scalafixEvaluate(ScalafixProvider.scala:373)
  at scala.meta.internal.metals.ScalafixProvider.$anonfun$runScalafixRules$1(ScalafixProvider.scala:132)
  at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470)
  ... 3 more

VSC version: 1.81.1
BSP
SBT version: 1.6.2
Scala version 2.11.12
Metals version: 1.0.0
Java Semantic DB version: 0.8.24
Semantic DB version: 4.8.3

WORKAROUND

fallback to Metals v0.11.12 Aluminium

@tgodzik
Copy link
Contributor

tgodzik commented Aug 17, 2023

Scalafix stopped supporting 2.11, not sure if I can do anything about that though 🤔 but we should at a minimum fix the issue at hand.

@tgodzik
Copy link
Contributor

tgodzik commented Aug 17, 2023

Btw. is there anything that can be done to help migrate your codebases to at least Scala 2.12.x ?

@franekfm
Copy link

@tgodzik I would love to migrate even to 2.13.x. Unfortunately my project is not running stand-alone but it is big corpo running Spark 2.3.0 using Scala 2.11.x (Java 1.8.121) on Hadoop Cluster CDP 5.16. I can try to upgrade to Scala 2.12.x but I have some shared libraries that are used by other teams and projects and not necessary they will like the idea as they prefer to compile their codebase with the same Scala line which is used for Spark.
Upgrading Hadoop to CDP 7.1 will be also huge for the big corpo thus I may take a long time before upgrade of CDP will happen.
Effectively I am rather stuck with 2.11.x unless 2.12.x is fully compatible with 2.11 for Spark.

@strobe
Copy link
Contributor

strobe commented Oct 12, 2023

I got same problem.

My sbt file has few sub-projects and most of those cross compiled to (2.11.12, 2.12.3, 2.13.4) but one project stuck on 2.11.12 (big legacy Play app) so as result 2.11.12 still configured as main version in build.sbt. Because of this issue seems auto completion doesn't work across all projects even if most can be compiled to 2.13).

@tgodzik
Copy link
Contributor

tgodzik commented Oct 12, 2023

There is a PR (scalameta/scalameta#3346) that should help, but we haven't yet released a new scalameta version. Probably scalafix will not work, so the only solution for now would be using older scalafix version. I should probably also just freeze the next Scala 2.11 version 🤔

@tgodzik
Copy link
Contributor

tgodzik commented Oct 19, 2023

Newest Metals version should support Scala 2.11.12 again. Only running scalafix rules and organize imports will fail.

@tgodzik
Copy link
Contributor

tgodzik commented Oct 19, 2023

Although I noticed it will only work on JDK 8 due to some old issue in the Scala compiler

@tgodzik
Copy link
Contributor

tgodzik commented Oct 19, 2023

I managed to get Scalafix working again in https://github.com/scalameta/metals/pull/5770/files though no bufixes for that rule will be available.

I will try to add back testing for 2.11.12 and close the issue.

@franekfm
Copy link

franekfm commented Nov 2, 2023

@tgodzik it should be fine for Scala 2.11.12 and JDK 8. Spark 2.3 will be running on JDK 8. Update on CDP (or HDP) will firstly update Scala version to at least 2.12 before updating Java version. That should be sufficient. Thanks a lot.

@tgodzik
Copy link
Contributor

tgodzik commented Nov 15, 2023

Added the test back in #5825

We will probably support Scala 2.11.12 indefinitely, but we will switch off active support at some point.

@tgodzik tgodzik closed this as completed Nov 15, 2023
@strobe
Copy link
Contributor

strobe commented Nov 16, 2023

Tested it with 1.1.0+78-3bc9060b-SNAPSHOT - it's works for my case. Thanks.

@tgodzik tgodzik added this to the Metals v1.1.1 milestone Dec 8, 2023
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

4 participants