scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
230 stars 21 forks source link

Scala 2.12.18 scalac help shows target as a valid option #12923

Closed altrack closed 5 months ago

altrack commented 6 months ago

Reproduction steps

Scala version: 2.12.18

scalac --help

Problem

Shows a flag that was deprecated in 2.12.17 as valid.
When trying to use one of the values - compiler shows a warning that the only valid option for Scala 2.12 is 8.

-target:<target>                     Target platform for object files. All JVM 1.5 - 1.7 targets are deprecated. (5,6,7,[8],9,10,11,12,13,14,15,16,17)

Expected

remove -target flag option support.

som-snytt commented 6 months ago

It complicates builds if options are not accepted across versions.

This case is just a limitation for 2.12.

Since -target is deprecated for all versions, the behavior does not introduce a warning.

The messaging is:

warning: -target is deprecated: Scala 2.12 cannot emit valid class files for targets newer than 8 (this is possible with Scala 2.13). Use -release to compile against a specific platform API version.
one warning found

or on 2.13

warning: -target is deprecated: Use -release instead to compile against the correct platform API.
1 warning

The only difficulty I detect is that the parenthetical on 2.12 is a bit run-on.

som-snytt commented 6 months ago

I must have broken the linking mechanism, but the linked PR is a fix in lieu of closing won't-fix. It expands the help a bit.

SethTisue commented 5 months ago

@altrack does https://github.com/scala/scala/pull/10638 LGTY?