JDK-8164073 : Javac should unconditionally warn if deprecated javadoc tag is used without @Deprecated annotation
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2016-08-16
  • Updated: 2017-05-17
  • Resolved: 2016-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.
9 b135Fixed
Related Reports
Relates :  
Sub Tasks
JDK-8177371 :  
Presently, javac emits a warning under -Xlint:dep-ann mode if the @deprecated javadoc tag is used on an entity that is also not @Deprecated annotated.

JDK-8072583 requests that this warning be made unconditional. Since the "core" part of JDK-8072583 viz that javac should no longer treat @deprecated javadoc tag as requesting formal deprecation can only be undertaken in a phased manner over multiple releases of JDK, I have created the present ticket to handle the unconditional warning part of the original request - which can be implemented for JDK9.

added jdk9-fc-yes

After, some discussion with Maurizio, I am exploring whether implementing level 2 as per Jon's classification i.e 2. lint warning, default on (fix the code or disable the warning, if you don't like it) will lead to a cleaner more readable implementation. Stay tuned.

@Stuart, this is an unconditional warning - so is level 3 in Jon's classification above. This would be suppressible either with a SuppressWarnings annotation or with command line switch -Xlint:-dep-ann

FC Extension Request Patch has been reviewed by Maurizio and is ready for push. @Jon, this needs your nod. TIA.

A final approved patch is available for push that - implements "level 2" (lint warning, default on (fix the code or disable the warning, if you don't like it) - this warning is default on only for source 9 (or above) - can be suppressed either via -Xlint:-dep-ann or @SW @Jon, waiting on your approval for FC Extension Request

Jon, thanks for the clarification. I think you're right that I'm thinking of level 2. If level 3 is indeed being proposed, I'd suggest a caution about this. There are relatively few unconditional warnings. The one that comes to mind is the inexact varargs call. That's pretty serious, because even though it's not ambiguous, it's quite likely a coding error. The @deprecated javadoc tag without an annotation is just "lint" that needs to be cleaned up. This doesn't seem like it's quite as severe.

There are various types of warning. 1. lint warning, default off (no warnings by default) 2. lint warning, default on (fix the code or disable the warning, if you don't like it) 3. unconditional warning (fix the code if you don't like it) I was assuming this issue was suggesting level 3. You (Stuart) are assuming more like level 2.

I don't know the javac code, but it seems to me this is basically enabling -Xlint:dep-ann by default. Presumably one could disable these warnings by specifying -Xlint:-dep-ann. Is this the case?

A fix is available that is under review.