JDK-8349848 : Support lint control of sunapi diagnostics
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • Submitted: 2025-02-11
  • Updated: 2025-05-08
  • Resolved: 2025-03-23
Related Reports
CSR :  
Relates :  
Relates :  
Description
There used to be an internal flag '-XDenableSunApiLintControl' to enable using -Xlint to control them, but it was removed as part of a cleanup of 'unused options' in JDK-8148808.

This enhancement proposes restoring the ability to control sunapi as a lint category, including with -Xlint: and @SuppressWarnings.

Making sunapi mandatory and unsuppressible may have been a deliberate choice to encourage users to migrate off the deprecated APIs instead of suppressing. (I don't know the history of that decision or JDK-8148808, clarifications on that are welcome.) However in practice, due to bug JDK-8349846 sunapi diagnostics can be suppressed by passing -XDignore.symbol.file or some values of --system, so there is a suppression mechanism, it's just an ad-hoc one.

Providing a way to suppress sunapi with -Xlint:-sunapi or @SuppressWarnings would provide a path to fixing JDK-8349846.
Comments
This idea was nixed on the compiler-dev mailing list. https://mail.openjdk.org/pipermail/compiler-dev/2025-February/029411.html
23-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/23650 Date: 2025-02-14 21:07:36 +0000
14-02-2025