APIdia Launch Partner
Top Description Constructors Methods
com.sun.tools.javac.api

public final Class JavacTool

extends Object
implements JavaCompiler
Class Inheritance
All Implemented Interfaces
javax.tools.JavaCompiler, javax.tools.OptionChecker, javax.tools.Tool
Imports
java.io.InputStream, .OutputStream, .OutputStreamWriter, .PrintWriter, .Writer, java.nio.charset.Charset, java.util.Collections, .EnumSet, .Locale, .Objects, .Set, javax.lang.model.SourceVersion, javax.tools.*, com.sun.source.util.JavacTask, com.sun.tools.javac.file.JavacFileManager, .BaseFileManager, .CacheFSInfo, com.sun.tools.javac.main.Arguments, .Option, com.sun.tools.javac.jvm.Target, com.sun.tools.javac.util.ClientCodeException, .Context, .DefinedBy, .DefinedBy.Api, .List, .Log, .PropagatedException

Todo

describe com.sun.tools.javac.api.Tool

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Author
Peter von der Ahé

Constructor Summary

AccessConstructor and Description
public
JavacTool()
Deprecated

Constructor used by service provider mechanism.

Method Summary

Modifier and TypeMethod and Description
public static JavacTool

Returns:

new instance of this tool
create
()

Static factory method for creating new instances of this tool.

public Set<SourceVersion>
getSourceVersions()

Implements javax.tools.Tool.getSourceVersions.

Returns the source versions of the Java programming language supported by this tool.

public JavacFileManager
getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset)

Implements javax.tools.JavaCompiler.getStandardFileManager.

Returns a new instance of the standard file manager implementation for this tool.

public JavacTask
getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits)

Implements javax.tools.JavaCompiler.getTask.

Creates a future for a compilation task with the given components and arguments.

public JavacTask
getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits, Context context)

public int
isSupportedOption(String option)

Implements javax.tools.OptionChecker.isSupportedOption.

Determines if the given option is supported and if so, the number of arguments the option takes.

public String
name()

Overrides default javax.tools.Tool.name.

Returns the name of this tool, or an empty string if no name is provided.

public int
run(InputStream in, OutputStream out, OutputStream err, String... arguments)

Implements javax.tools.Tool.run.

Run the tool with the given I/O channels and arguments.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JavacToolback to summary
public JavacTool()

Deprecated

Constructor used by service provider mechanism. The recommended way to obtain an instance of this class is by using create or the service provider mechanism.

Annotations
@Deprecated
See Also
javax.tools.JavaCompiler, javax.tools.ToolProvider, create

Method Detail

createback to summary
public static JavacTool create()

Static factory method for creating new instances of this tool.

Returns:JavacTool

new instance of this tool

getSourceVersionsback to summary
public Set<SourceVersion> getSourceVersions()

Implements javax.tools.Tool.getSourceVersions.

Doc from javax.tools.Tool.getSourceVersions.

Returns the source versions of the Java programming language supported by this tool.

Annotations
@Override
@DefinedBy:COMPILER
getStandardFileManagerback to summary
public JavacFileManager getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset)

Implements javax.tools.JavaCompiler.getStandardFileManager.

Doc from javax.tools.JavaCompiler.getStandardFileManager.

Returns a new instance of the standard file manager implementation for this tool. The file manager will use the given diagnostic listener for producing any non-fatal diagnostics. Fatal errors will be signaled with the appropriate exceptions.

The standard file manager will be automatically reopened if it is accessed after calls to flush or close. The standard file manager must be usable with other tools.

Annotations
@Override
@DefinedBy:COMPILER
getTaskback to summary
public JavacTask getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits)

Implements javax.tools.JavaCompiler.getTask.

Doc from javax.tools.JavaCompiler.getTask.

Creates a future for a compilation task with the given components and arguments. The compilation might not have completed as described in the CompilationTask interface.

If a file manager is provided, it must be able to handle all locations defined in StandardLocation.

Note that annotation processing can process both the compilation units of source code to be compiled, passed with the compilationUnits parameter, as well as class files, whose names are passed with the classes parameter.

Annotations
@Override
@DefinedBy:COMPILER
getTaskback to summary
public JavacTask getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits, Context context)
isSupportedOptionback to summary
public int isSupportedOption(String option)

Implements javax.tools.OptionChecker.isSupportedOption.

Doc from javax.tools.OptionChecker.isSupportedOption.

Determines if the given option is supported and if so, the number of arguments the option takes.

Annotations
@Override
@DefinedBy:COMPILER
nameback to summary
public String name()

Overrides default javax.tools.Tool.name.

Doc from javax.tools.Tool.name.

Returns the name of this tool, or an empty string if no name is provided.

Annotations
@DefinedBy:COMPILER
runback to summary
public int run(InputStream in, OutputStream out, OutputStream err, String... arguments)

Implements javax.tools.Tool.run.

Doc from javax.tools.Tool.run.

Run the tool with the given I/O channels and arguments. By convention a tool returns 0 for success and nonzero for errors. Any diagnostics generated will be written to either out or err in some unspecified format.

Annotations
@Override
@DefinedBy:COMPILER