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

NoSuchElementException when running migrateTypes #450

Closed
kluen opened this issue Jan 12, 2024 · 1 comment · Fixed by #451
Closed

NoSuchElementException when running migrateTypes #450

kluen opened this issue Jan 12, 2024 · 1 comment · Fixed by #451

Comments

@kluen
Copy link

kluen commented Jan 12, 2024

I'm trying to migrate a project to Scala 3 and am following the migration guide. At the migrateTypes step, I'm running into this error:

[info] Defining scalaVersion
[info] The new value will be used by Compile / bspBuildTarget, Compile / dependencyTreeCrossProjectId and 71 others.
[info] 	Run `last` for details.
[info] Reapplying settings...
[info] set current project to <redacted> (in build file:<redacted>)
[info]
[info] Migrating types in <redacted> / Compile
[info]
bad option '-Ymacro-annotations' was ignored
bad option '-Xsource:3' was ignoredeTypes 1s
missing argument for option -Wunused
  scalac -help  gives more information
[error] Migration of <redacted> / compile failed.
[error] stack trace is suppressed; run last internalMigrateTypes for the full output
[error] (internalMigrateTypes) java.util.NoSuchElementException: None.get
[error] Total time: 3 s, completed 12 Jan 2024, 5:05:32 pm
[info] Defining scalaVersion
[info] The new value will be used by Compile / bspBuildTarget, Compile / dependencyTreeCrossProjectId and 71 others.
[info] 	Run `last` for details.
[info] Reapplying settings...
[info] set current project to <redacted> (in build file:<redacted>)
[error] Migration of <redacted> failed.

So as suggested, I ran the command given:

sbt:<redacted>> last internalMigrateTypes
[error] java.util.NoSuchElementException: None.get
[error] 	at scala.None$.get(Option.scala:627)
[error] 	at scala.None$.get(Option.scala:626)
[error] 	at migrate.compiler.interfaces.Scala3Driver.setup(Scala3Driver.java:22)
[error] 	at migrate.compiler.interfaces.Scala3Driver.setupCompiler(Scala3Driver.java:18)
[error] 	at migrate.compiler.interfaces.Scala3Compiler.setup(Scala3Compiler.java:46)
[error] 	at migrate.Scala3Migrate.$anonfun$setupScala3Compiler$2(Scala3Migrate.scala:89)
[error] 	at scala.util.Try$.apply(Try.scala:210)
[error] 	at migrate.Scala3Migrate.setupScala3Compiler(Scala3Migrate.scala:89)
[error] 	at migrate.Scala3Migrate.migrate(Scala3Migrate.scala:49)
[error] 	at migrate.interfaces.MigrateImpl.$anonfun$migrate$15(MigrateImpl.scala:54)
[error] 	at scala.util.Success.flatMap(Try.scala:258)
[error] 	at migrate.interfaces.MigrateImpl.$anonfun$migrate$13(MigrateImpl.scala:40)
[error] 	at scala.util.Success.flatMap(Try.scala:258)
[error] 	at migrate.interfaces.MigrateImpl.$anonfun$migrate$12(MigrateImpl.scala:39)
[error] 	at scala.util.Success.flatMap(Try.scala:258)
[error] 	at migrate.interfaces.MigrateImpl.$anonfun$migrate$11(MigrateImpl.scala:38)
[error] 	at scala.util.Success.flatMap(Try.scala:258)
[error] 	at migrate.interfaces.MigrateImpl.$anonfun$migrate$8(MigrateImpl.scala:36)
[error] 	at scala.util.Success.flatMap(Try.scala:258)
[error] 	at migrate.interfaces.MigrateImpl.$anonfun$migrate$5(MigrateImpl.scala:34)
[error] 	at scala.util.Success.flatMap(Try.scala:258)
[error] 	at migrate.interfaces.MigrateImpl.$anonfun$migrate$4(MigrateImpl.scala:33)
[error] 	at scala.util.Success.flatMap(Try.scala:258)
[error] 	at migrate.interfaces.MigrateImpl.$anonfun$migrate$2(MigrateImpl.scala:32)
[error] 	at scala.util.Success.flatMap(Try.scala:258)
[error] 	at migrate.interfaces.MigrateImpl.migrate(MigrateImpl.scala:31)
[error] 	at migrate.TypeInferenceMigration$.$anonfun$migrateConfig$4(TypeInferenceMigration.scala:51)
[error] 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] 	at scala.util.Try$.apply(Try.scala:213)
[error] 	at migrate.TypeInferenceMigration$.$anonfun$migrateConfig$1(TypeInferenceMigration.scala:40)
[error] 	at migrate.TypeInferenceMigration$.$anonfun$migrateConfig$1$adapted(TypeInferenceMigration.scala:29)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] 	at sbt.Execute.work(Execute.scala:292)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] 	at java.base/java.lang.Thread.run(Thread.java:833)
[error] (internalMigrateTypes) java.util.NoSuchElementException: None.get

This is unfortunately not useful to the user.

It turns out, when you look a bit more closely at the output, there is a hint at what is actually the problem:

missing argument for option -Wunused

I removed the option and it works. It would be great if this message is shown in the [error] output instead of the exception.

The version of the plugin I used is 0.6.2.

@adpi2
Copy link
Member

adpi2 commented Jan 17, 2024

Thanks for the report!

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

Successfully merging a pull request may close this issue.

2 participants