JDK-8353221 : Code to forcibly set -Xlint:-options can be removed
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 25
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2025-03-29
  • Updated: 2025-03-29
  • Resolved: 2025-03-29
Related Reports
Causes :  
Duplicate :  
Description
Back in 2011, in order to prevent repeated warnings about bootclasspath not being set (JDK-7022337), code was added to JavaCompiler.java to forcibly set the `-Xlint:-options` flag after compiler startup:

        // forcibly set the equivalent of -Xlint:-options, so that no further
        // warnings about command line options are generated from this point on
        options.put(XLINT_CUSTOM.primaryName + "-" + LintCategory.OPTIONS.option, "true");
        options.remove(XLINT_CUSTOM.primaryName + LintCategory.OPTIONS.option);

This workaround complicates logic relating to warnings in the `"options"` category and, due to improvements to the compiler design since then, it's no longer needed to actually fix the problem. So it can be removed.

As a separate cleanup, the field "optionsCheckingInitiallyDisabled" in JavaCompiler.java is no longer used and so it can also be removed.

Comments
Oops, forgot I had already filed this as JDK-8352731.
29-03-2025