-
Notifications
You must be signed in to change notification settings - Fork 928
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
sbt 1.6.2 on OpenJDK 18 is broken #6925
Comments
You're using an early-access build of JDK 18. Does the same thing occur in a final-release build? fwiw, I'm on JDK 18 final (Eclipse Adoptium Java 18.0.1) on MacOS and sbt 1.6.2 works fine for me. |
Yea it worked last time I checked on macOS |
I have the same problem 😔 |
@zmerr I am not sure what the repro steps are here. It worked with the latest Eclipse Temurin on Mac. What operating system and JDK are you using? |
@eed3si9n I have MacOS I had the same problem with installed through But it was workin on all the projects, except one which had So as a silly temporary fix, I just removed java 18 and installed adoptopenjdk15, instead. But this is not a real solution, because effectively this broke everything else that was supposed to work on java 18. |
mine was not working with openjdk 18.0.1 2022-04-19 |
I met the same problem with jdk18.0.1.1. |
I am guessing that this is coming from the following code in the launcher https://github.com/sbt/launcher/blob/605b67814f4f1a2ed6ddd46213ffec8e8e58ec2e/launcher-implementation/src/main/scala/xsbt/boot/Launch.scala#L148-L150: try {
withContextLoader(appProvider.loader)(main.run(appConfig))
} catch { case e: xsbti.FullReload => if (e.clean) delete(launcher.bootDirectory); throw e } Did something change in JDK 18 that's preventing a pattern match written in Scala? |
Seeing the same error on
Can confirm that it doesn't appear with jdk 17. |
It would help if we had the stack trace for the underlying |
I put out a call for assistance at https://twitter.com/SethTisue/status/1541822426203291648 what we need is a way to reproduce the problem. for example, is anyone able to make it happen in a GitHub Actions run in a public GitHub repo? are any of you able to make it happen in a brand new, empty user account on a MacOS machine? (or any other OS?) if so, can you share steps? |
Mine is reproducible when this is in the build file:
|
What happens if you change JRE to JDK? |
Mac intel chip. |
I managed to reproduce this issue on sbt 1.5.8, on Window, Mac, Ubuntu and many different Java 18 implementations. But as soon as I bump to sbt 1.6.0, the problem disappears. Same if I use Java 17, no crash. The result of this investigation can be found here. I tested it also on Mac M1 and I have the exact same behavior. Still, I am a bit surprised by the title of this issue So I am quite sure now that this bug only happens on sbt 1.5.8 and there is a fix in sbt 1.6.0 that we can backport. |
Here is the fix: https://github.com/adpi2/sbt/tree/fix-JDK-18 But there is no branch The solution is to upgrade your build to 1.6.2. |
Please reopen this issue if I am wrong and the same error appears on sbt 1.6.x. |
Thanks for the investigation @adpi2! |
I am having this problem with SBT 1.7.1 & openJDK 18. I am running MacOS (Apple M1) and installed SBT via brew. I am trying to run chisel... |
In chipsalliance/chisel3, the version of sbt is still 1.5.8, that's why it does not work. https://github.com/chipsalliance/chisel3/blob/master/project/build.properties |
Ah okay, the MacOS instructions I was following just said to "brew install sbt" it never specified a particluar version. Thanks for your help, I will try this out. |
I just hit this because https://github.com/coursier/interface is on 1.5.8. Maybe there is a way to advertise the limitation. Or hold a spree just for upgrading the entire ecosystem to 1.7.1. Or one day in which Scala Steward gets merge rights on every repository. |
For those visiting this ticket who may be relatively new to sbt: it's important to understand that when you run Thus: Even if you've installed sbt 1.6 or 1.7 on your system, you may still need to update |
Can't build with java 18 otherwise (sbt/sbt#6925).
Can't build with java 18 otherwise (sbt/sbt#6925).
It is the latest version and fixes building on JDK 18. See sbt/sbt#6925
It is the latest version and fixes building on JDK 18. See sbt/sbt#6925
@adpi2 Thanks a lot for your help! I have tried to fix this problem for about an hour and finally solved it in a minute with your help! |
Thanks @SethTisue and @adpi2 - being a newbie to scala, these were great timesavers for me - worked like a charm. |
steps
sbt compile
problem
expectation
should compile project without error
notes
observed on Pop_OS 22.04.
Java version:
The text was updated successfully, but these errors were encountered: