<div dir="ltr"><div dir="ltr"><div>Hi Jon,</div><div><br></div><div>Thanks for the comments.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Nov 9, 2024 at 5:29 PM Jonathan Gibbons <<a href="mailto:jjg3@pobox.com">jjg3@pobox.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div><p>1. The set of strings that are valid for @SuppressWarnings is
undefined and open-ended. Yes, the JDK compiler `javac` defines a
set of strings but there is no guarantee that code will only be
compiled by `javac` and that there are no other strings in use.
Some IDEs may also use the @SuppressWarnings mechanism.<br></p></div></blockquote><div>Thanks - I should have made that point clear. This new functionality would be limited to the actual warnings implemented by javac. </div><div><br></div><div>In other words, there must be a corresponding <span style="font-family:monospace">LintCategory</span> enum value; string values in <span style="font-family:monospace">@SuppressWarnings</span> annotations that don't correspond to actual javac warnings would be completely ignored/unaffected by this.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p>
</p><p>JLS also says <font size="2"><span style="color:rgb(0,0,0);font-family:Arial,Helvetica,sans-serif;font-style:italic;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration:none;display:inline;float:none">Compiler
vendors are encouraged to document the strings they support for<span> </span></span><code style="color:rgb(0,0,0);font-style:italic;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">@SuppressWarnings</code><span style="color:rgb(0,0,0);font-family:Arial,Helvetica,sans-serif;font-style:italic;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration:none;display:inline;float:none">,
and to cooperate to ensure that the same strings are recognized
across multiple compilers</span></font><span style="color:rgb(0,0,0);font-family:Arial,Helvetica,sans-serif;font-size:10.2px;font-style:italic;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration:none;display:inline;float:none">.</span> so we should document this in
such a way that other tools are encouraged to support the same
string with the same semantics.</p></div></blockquote><div>Yep, thanks. A basic Google search didn't reveal any examples of other compilers having a similar option for the <span style="font-family:monospace">@SuppressWarnings</span> annotation. If you know of any, we should certainly try to be consistent.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<p>3. I note that the JDK `javadoc` tool supports variations on
`@SuppressWarnings("doclint"), corresponding to the `-Xdoclint`
option supported by both `javac` and `javadoc`, although there has
been informal discussions on dropping support from `javac`. See
here:
<a href="https://docs.oracle.com/en/java/javase/23/docs/specs/man/javadoc.html#doclint" target="_blank">https://docs.oracle.com/en/java/javase/23/docs/specs/man/javadoc.html#doclint</a></p></div></blockquote><div>I've run across a few of these. For now they're being treated just like any other unknown value - i.e., being ignored.</div><div><br></div><div>A reasonable future task would be to implement the analogous functionality for Javadoc warnings but I haven't investigated that.</div><div><br></div><div>In any case it seems clear that this should be done as part of the javadoc tool, not javac. The two "worlds" (i.e., javac vs. javadoc) should be handled separately for this kind of analysis. In other words, I wouldn't want my javac compiler warning me about unnecessary <span style="font-family:monospace">doclint:foo</span> suppressions, or vice-versa.<br></div></div><div class="gmail_quote"><br></div><div class="gmail_quote">Thanks,<br></div><div class="gmail_quote">-Archie</div><div class="gmail_quote"><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>