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

Align -release and -target with Scala 3 #12543

Closed
som-snytt opened this issue Mar 2, 2022 · 3 comments · Fixed by scala/scala#9982
Closed

Align -release and -target with Scala 3 #12543

som-snytt opened this issue Mar 2, 2022 · 3 comments · Fixed by scala/scala#9982
Assignees
Labels
Milestone

Comments

@som-snytt
Copy link

reproduction steps

As proposed at scala/scala3#14606

problem

Everything is easier when compiler options align on Scala2/3 especially for cross-compilers and migrators.

@SethTisue
Copy link
Member

Milestone for 2.13.9 since we should at least consider this in that timeframe.

Is it only proposed to add new aliases for existing flags (which is pretty easy to justify/accept)? Or is there any question of altering existing behavior?

@som-snytt
Copy link
Author

smarter said behavior, but I don't know yet as I am ignorant.

@prolativ
Copy link

prolativ commented Mar 3, 2022

In scala 3:
-Xtarget / -Xunchecked-java-output-version - specifies the version of produced JVM bytecode
-release / -java-output-version - as above + it checks if the produced bytecode will be safe to use (if the referenced methods/classes/etc. will be available)
So the former setting is redundant when the latter is used and it's also unsafe so there are hardly any situations when someone might really want to use -Xtarget.
To my understanding currently in scala 2 -release itself only performs the checks but does not set the version of produced bytecode so it's not really useful unless -target (without X) with the same value of java version is used.
The idea is to make -release in scala 2 (or -java-output-version after the renaming) have the same twofold effect as in scala 3.
Here's the PR introducing this semantic change in scala 3 scala/scala3#10746, which was itself a port from scala 2 with some improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants