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

Suggest using a newer JDK for unavailable options in -java-output-version #20373

Open
BalmungSan opened this issue May 9, 2024 · 3 comments
Open
Labels
better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement

Comments

@BalmungSan
Copy link

BalmungSan commented May 9, 2024

Compiler version

3.3.3

Minimized code

cs launch scala:3.3.3 -- -java-output-version 21

Output

21 is not a valid choice for -java-output-version

Expectation

According to the JDK compatibility page: https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html
Scala 3 supports Java 21 since 3.3.1.
Yet, despite that, the compiler rejects 21 as a valid Java output version. Furthermore, printing the -help of the compiler and looking for -java-output-version only lists up to Java 17 as supported targets.

I would expect to be able to use 21 as a valid Java output version. This, in turn, should allow me to:

@BalmungSan BalmungSan added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 9, 2024
@BalmungSan
Copy link
Author

False alarm, it does accept 21 as long as your JDK is also at least 21; which makes total sense.
I was running on a 17 JDK when I tested this, which explains why it only shown 17 as the maximum supported target.

Having said that, IMHO, the error message was really misleading.
Something along the lines of

While 21 is supported by the compiler, your current environment is running in version 17, thus 21 is an invalid target.

Or something similar (English is not my first language, so the redaction can probably be improved).


This issue is no longer a "Bug report" but rather a "Error/Warning message report".

@Gedochao Gedochao added itype:enhancement better-errors Issues concerned with improving confusing/unhelpful diagnostic messages and removed itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 9, 2024
@SethTisue
Copy link
Member

I was fooled by this as well. I agree the error message is worth improving.

@Gedochao Gedochao changed the title 21 is not a valid choice for -java-output-version Suggest using a newer JDK for unavailable options in -java-output-version May 9, 2024
@som-snytt
Copy link
Contributor

also -java-output-version:help is not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement
Projects
None yet
Development

No branches or pull requests

4 participants