| |||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
Diagnostic | Interface for diagnostics from tools. |
DiagnosticListener | Interface for receiving diagnostics from tools. |
FileObject | File abstraction for tools. |
JavaCompiler | Interface to invoke Java™ programming language compilers from programs. |
JavaCompiler.CompilationTask | Interface representing a future for a compilation task. |
JavaFileManager | File manager for tools operating on Java™ programming language source and class files. |
JavaFileManager.Location | Interface for locations of file objects. |
JavaFileObject | File abstraction for tools operating on Java™ programming language source and class files. |
OptionChecker | Interface for recognizing options. |
StandardJavaFileManager | File manager based on java.io.File. |
Tool | Common interface for tools that can be invoked from a program. |
Class Summary | |
---|---|
DiagnosticCollector | Provides an easy way to collect diagnostics in a list. |
ForwardingFileObject | Forwards calls to a given file object. |
ForwardingJavaFileManager | Forwards calls to a given file manager. |
ForwardingJavaFileObject | Forwards calls to a given file object. |
SimpleJavaFileObject | Provides simple implementations for most methods in JavaFileObject. |
ToolProvider | Provides methods for locating tool providers, for example, providers of compilers. |
Enum Summary | |
---|---|
Diagnostic.Kind | Kinds of diagnostics, for example, error or warning. |
JavaFileObject.Kind | Kinds of JavaFileObjects. |
StandardLocation | Standard locations of file objects. |
These interfaces and classes are required as part of the Java™ Platform, Standard Edition (Java SE), but there is no requirement to provide any tools implementing them.
Unless explicitly allowed, all methods in this package might throw a {@linkplain java.lang.NullPointerException} if given a {@code null} argument or if given a {@linkplain java.lang.Iterable list or collection} containing {@code null} elements. Similarly, no method may return {@code null} unless explicitly allowed.
This package is the home of the Java programming language compiler framework. This framework allows clients of the framework to locate and run compilers from programs. The framework also provides Service Provider Interfaces (SPI) for structured access to diagnostics ({@linkplain javax.tools.DiagnosticListener}) as well as a file abstraction for overriding file access ({@linkplain javax.tools.JavaFileManager} and {@linkplain javax.tools.JavaFileObject}). See {@linkplain javax.tools.JavaCompiler} for more details on using the SPI.
There is no requirement for a compiler at runtime. However, if a default compiler is provided, it can be located using the {@linkplain javax.tools.ToolProvider}, for example:
{@code JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();}
It is possible to provide alternative compilers or tools through the {@linkplain java.util.ServiceLoader service provider mechanism}.
For example, if {@code com.vendor.VendorJavaCompiler} is a provider of the {@code JavaCompiler} tool then its jar file would contain the file {@code META-INF/services/javax.tools.JavaCompiler}. This file would contain the single line:
{@code com.vendor.VendorJavaCompiler}
If the jar file is on the class path, VendorJavaCompiler can be located using code like this:
{@code JavaCompiler compiler = ServiceLoader.load(JavaCompiler.class).iterator().next();}
| |||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |