RFR: 8235876: Misleading warning message in java source-file mode

Adam Sotona asotona at openjdk.java.net
Wed Nov 24 13:45:16 UTC 2021


Execution of  `java --source 7 Test.java` displays following warning: 
`warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.` 

However use of `-Xlint:-options` is not allowed and so it proposes an invalid suggestion.

This is yet another case of "too much information" provided to user in source-file mode. 
Target audience of source-file mode are Java beginners with very simple cases.
Many options are not available in source-file mode and so this patch disables also related options warnings.

The case is similar to JDK-8268869

Patch adds `-Xlint:-options` into the list of default javac options in source-file mode.
Relevant test is also provided.

Thanks,
Adam

-------------

Commit messages:
 - 8235876: Misleading warning message in java source-file mode

Changes: https://git.openjdk.java.net/jdk/pull/6537/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6537&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8235876
  Stats: 16 lines in 2 files changed: 15 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6537.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6537/head:pull/6537

PR: https://git.openjdk.java.net/jdk/pull/6537


More information about the compiler-dev mailing list