Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
8280826: Document set of strings javac recognizes for SuppressWarnings
Reviewed-by: darcy
  • Loading branch information
jonathan-gibbons committed Jun 27, 2022
1 parent 2c8ada6 commit 7746664
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
62 changes: 62 additions & 0 deletions src/jdk.compiler/share/classes/module-info.java
Expand Up @@ -59,6 +59,68 @@
* {@code jdk.zipfs} module, must be available if the compiler is to be able
* to read JAR files.
*
* <h3>SuppressWarnings</h3>
*
* JLS {@jls 9.6.4.5} specifies a number of strings that can be used to
* suppress warnings that may be generated by a Java compiler.
*
* In addition, <em>javac</em> also supports other strings that can be used
* to suppress other kinds of warnings. The following table lists all the
* strings that can be used with {@code @SuppressWarnings}.
*
* <table class="striped">
* <caption>Strings supported by {@code SuppressWarnings}</caption>
* <thead>
* <tr><th>String<th>Suppress Warnings About ...
* </thead>
* <tbody>
* <tr><th scope="row">{@code auxiliaryclass} <td>an auxiliary class that is hidden in a source file, and is used
* from other files
* <tr><th scope="row">{@code cast} <td>use of unnecessary casts
* <tr><th scope="row">{@code classfile} <td>issues related to classfile contents
* <tr><th scope="row">{@code deprecation} <td>use of deprecated items
* <tr><th scope="row">{@code dep-ann} <td>items marked as deprecated in a documentation comment but not
* using the {@code @Deprecated} annotation
* <tr><th scope="row">{@code divzero} <td>division by constant integer {@code 0}
* <tr><th scope="row">{@code empty} <td>empty statement after {@code if}
* <tr><th scope="row">{@code exports} <td>issues regarding module exports
* <tr><th scope="row">{@code fallthrough} <td>falling through from one case of a {@code switch} statement to
* the next
* <tr><th scope="row">{@code finally} <td>{@code finally} clauses that do not terminate normally
* <tr><th scope="row">{@code missing-explicit-ctor} <td>missing explicit constructors in public and protected classes
* in exported packages
* <tr><th scope="row">{@code module} <td>module system related issues
* <tr><th scope="row">{@code opens} <td>issues regarding module opens
* <tr><th scope="row">{@code overloads} <td>issues regarding method overloads
* <tr><th scope="row">{@code overrides} <td>issues regarding method overrides
* <tr><th scope="row">{@code path} <td>invalid path elements on the command line
* <tr><th scope="row">{@code preview} <td>use of preview language features
* <tr><th scope="row">{@code rawtypes} <td>use of raw types
* <tr><th scope="row">{@code removal} <td>use of API that has been marked for removal
* <tr><th scope="row">{@code requires-automatic} <td>use of automatic modules in the {@code requires} clauses
* <tr><th scope="row">{@code requires-transitive-automatic} <td>automatic modules in {@code requires transitive}
* <tr><th scope="row">{@code serial} <td>{@link java.base/java.io.Serializable Serializable} classes
* that do not have a {@code serialVersionUID} field, or other
* suspect declarations in {@code Serializable} and
* {@link java.base/java.io.Externalizable Externalizable} classes
* and interfaces
* <tr><th scope="row">{@code static} <td>accessing a static member using an instance
* <tr><th scope="row">{@code strictfp} <td>unnecessary use of the {@code strictfp} modifier
* <tr><th scope="row">{@code synchronization} <td>synchronization attempts on instances of value-based classes
* <tr><th scope="row">{@code text-blocks} <td>inconsistent white space characters in text block indentation
* <tr><th scope="row">{@code try} <td>issues relating to use of {@code try} blocks
* (that is, try-with-resources)
* <tr><th scope="row">{@code unchecked} <td>unchecked operations
* <tr><th scope="row">{@code varargs} <td>potentially unsafe vararg methods
* <tr><th scope="row">{@code doclint:accessibility} <td>accessibility issues found in documentation comments
* <tr><th scope="row">{@code doclint:all} <td>all issues found in documentation comments
* <tr><th scope="row">{@code doclint:html} <td>HTML issues found in documentation comments
* <tr><th scope="row">{@code doclint:missing} <td>missing items in documentation comments
* <tr><th scope="row">{@code doclint:reference} <td>reference issues found in documentation comments
* <tr><th scope="row">{@code doclint:syntax} <td>syntax issues found in documentation comments
* </tbody>
* </table>
*
* @toolGuide javac
*
* @provides java.util.spi.ToolProvider
Expand Down
11 changes: 10 additions & 1 deletion src/jdk.compiler/share/man/javac.1
Expand Up @@ -691,7 +691,7 @@ Enables or disables specific groups of checks in documentation comments.
.PP
\f[I]group\f[R] can have one of the following values:
\f[CB]accessibility\f[R], \f[CB]html\f[R], \f[CB]missing\f[R],
\f[CB]reference\f[R], \f[CB]syntax\f[R]
\f[CB]reference\f[R], \f[CB]syntax\f[R].
.PP
The variable \f[I]access\f[R] specifies the minimum visibility level of
classes and members that the \f[CB]\-Xdoclint\f[R] option checks.
Expand All @@ -701,6 +701,11 @@ visible): \f[CB]public\f[R], \f[CB]protected\f[R], \f[CB]package\f[R],
.PP
The default \f[I]access\f[R] level is \f[CB]private\f[R].
.PP
When prefixed by \f[CB]doclint:\f[R], the \f[I]group\f[R] names and
\f[CB]all\f[R] can be used with \f[CB]\@SuppressWarnings\f[R] to suppress
warnings about documentation comments in parts of the code being
compiled.
.PP
For more information about these groups of checks, see the
\f[B]DocLint\f[R] section of the \f[CB]javadoc\f[R] command documentation.
The \f[CB]\-Xdoclint\f[R] option is disabled by default in the
Expand Down Expand Up @@ -838,6 +843,10 @@ methods.
.IP \[bu] 2
\f[CB]none\f[R]: Disables all warnings.
.PP
With the exception of \f[CB]all\f[R] and \f[CB]none\f[R], the keys can be
used with the \f[CB]\@SuppressWarnings\f[R] annotation to suppress
warnings in a part of the source code being compiled.
.PP
See \f[B]Examples of Using \-Xlint keys\f[R].
.RE
.TP
Expand Down

1 comment on commit 7746664

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.