JDK-6356679 : add an option to disable the suppression of warnings
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P5
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-11-29
  • Updated: 2025-09-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
The @SuppressWarning annotation allows the developer to suppress warnings of a particular category

This enhancement requests that sun add an additional command qualified to the javac command, to allow the compiler to emit more detailed messaged which would otherwise be suppressed


JUSTIFICATION :
When a developer writes some code and suppresses warning witth the @SuppressWarning annotation then the details of the warnign are not produced.

For code review purposes it would be useful to disable this suppression for the the reviewees can see the warning, and assess the risk, and perhaps change the code (or some other library) so as to eliminate the warning, and therefore the need for the suppression

Also if a method is marked with @SuppressWarnings("unchecked") to cater for some API limitation. If then subsiquently the code is modified to add some additional feature (which through some coding error) has some other unchecked warning, then the warning will not be masked.

As the annotation refers to the method, not the line then there s no easy was to detect this

If a facility like this enhancement was implemented then the QA of the code could comple the code with this suppression disabled and the detect that the cont of suppressed warnings has changed, and investigate further

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
javac -XdisableSuppressedWarnings -Xlint ....
Warning ..... [unchecked] ...

or

javac -XsuppressedWarningsAsNotes -Xlint ....
Note ... [unchecked] ....
ACTUAL -
javac -Xlint ....

Note: ... uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

(when lint was actually specified

CUSTOMER SUBMITTED WORKAROUND :
checkout code
delete all @suppress warnings
compile

checkout code
make changes
checkin code

and repeat ...

Comments
EVALUATION We could consider extending the syntax of -Xlint, so that -Xlint:unchecked! would ignore @SuppressWarnings("unchecked").
30-11-2005