8268869: java in source-file mode suggests javac-only Xlint flags

Adam Sotona adam.sotona at oracle.com
Tue Jul 27 12:29:58 UTC 2021


Please review.

Thank you,
Adam

On 28.06.2021 15:48, "compiler-dev on behalf of Adam Sotona" <compiler-dev-retn at openjdk.java.net on behalf of asotona at openjdk.java.net> wrote:

    java in source-file mode (see JEP 330) displays compiler notes suggesting recompile with -Xlint:deprecation and -Xlint:unchecked. According JEP 330 these advanced javac optionns are not allowed. The goal with JEP 330 was to support developers that are at the early stages of learning Java, so options such as -Xlint are out of their scope.

    This patch prevents displaying "Note: Recompile with -Xlint:deprecation for details." and "Note: Recompile with -Xlint:unchecked for details."   by implicitly enabling -Xlint:deprecation and -Xlint:unchecked in com.sun.tool.javac.launcher.Main for all invocations.

    Beside avoiding prohibited javac option suggestion notes this patch has positive effect of more verbose compilation diagnostic. Higher diagnostic verbosity is appreciated by users learning Java on single-source programs in java source-file mode.

    Similar case with -Xdiags:verbose was reported in JDK-8248843 and resolved in commit openjdk/jdk/31d0f0d8after review openjdk/jdk/4094

    The patch also provides new test "testNoRecompileWithSuggestions" detecting unwanted recompilation suggestions in java in source-file mode execution. The test cover also case from JDK-8248843 with -Xdiags:verbose

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

    Commit messages:
     - 8268869: java in source-file mode suggests javac-only Xlint flags

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

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



More information about the compiler-dev mailing list