Module jdk.compiler


module jdk.compiler
Defines the implementation of the system Java compiler and its command line equivalent, javac.

The com.sun.source.* packages provide the Compiler Tree API: an API for accessing the abstract trees (ASTs) representing Java source code and documentation comments, used by javac, javadoc and related tools.

javac

This module provides the equivalent of command-line access to javac via the ToolProvider and Tool service provider interfaces (SPIs), and more flexible access via the JavaCompiler SPI.

Instances of the tools can be obtained by calling ToolProvider.findFirst or the service loader with the name "javac".

In addition, instances of JavaCompiler.CompilationTask obtained from JavaCompiler can be downcast to JavacTask for access to lower level aspects of javac, such as the Abstract Syntax Tree (AST).

This module uses the FileSystemProvider API to locate file system providers. In particular, this means that a jar file system provider, such as that in the jdk.zipfs module, must be available if the compiler is to be able to read JAR files.

SuppressWarnings

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, javac 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 @SuppressWarnings.
Strings supported by SuppressWarnings
StringSuppress Warnings About ...
auxiliaryclass an auxiliary class that is hidden in a source file, and is used from other files
cast use of unnecessary casts
classfile issues related to classfile contents
deprecation use of deprecated items
dep-ann items marked as deprecated in a documentation comment but not using the @Deprecated annotation
divzero division by constant integer 0
empty empty statement after if
exports issues regarding module exports
fallthrough falling through from one case of a switch statement to the next
finally finally clauses that do not terminate normally
missing-explicit-ctor missing explicit constructors in public and protected classes in exported packages
module module system related issues
opens issues regarding module opens
overloads issues regarding method overloads
overrides issues regarding method overrides
path invalid path elements on the command line
preview use of preview language features
rawtypes use of raw types
removal use of API that has been marked for removal
requires-automatic use of automatic modules in the requires clauses
requires-transitive-automatic automatic modules in requires transitive
serial Serializable classes that do not have a serialVersionUID field, or other suspect declarations in Serializable and Externalizable classes and interfaces
static accessing a static member using an instance
strictfp unnecessary use of the strictfp modifier
synchronization synchronization attempts on instances of value-based classes
text-blocks inconsistent white space characters in text block indentation
try issues relating to use of try blocks (that is, try-with-resources)
unchecked unchecked operations
varargs potentially unsafe vararg methods
doclint:accessibility accessibility issues found in documentation comments
doclint:all all issues found in documentation comments
doclint:html HTML issues found in documentation comments
doclint:missing missing items in documentation comments
doclint:reference reference issues found in documentation comments
doclint:syntax syntax issues found in documentation comments
Module Graph:
Module graph for jdk.compilerModule graph for jdk.compiler
Tool Guides:
javac
Since:
9