public final class JavacTool extends Object implements JavaCompiler
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.
JavaCompiler.CompilationTask
Constructor and Description |
---|
JavacTool()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static JavacTool |
create()
Static factory method for creating new instances of this tool.
|
Set<SourceVersion> |
getSourceVersions()
Gets the source versions of the Java™ programming language
supported by this tool.
|
JavacFileManager |
getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener,
Locale locale,
Charset charset)
Gets a new instance of the standard file manager implementation
for this tool.
|
JavacTask |
getTask(Writer out,
JavaFileManager fileManager,
DiagnosticListener<? super JavaFileObject> diagnosticListener,
Iterable<String> options,
Iterable<String> classes,
Iterable<? extends JavaFileObject> compilationUnits)
Creates a future for a compilation task with the given
components and arguments.
|
JavacTask |
getTask(Writer out,
JavaFileManager fileManager,
DiagnosticListener<? super JavaFileObject> diagnosticListener,
Iterable<String> options,
Iterable<String> classes,
Iterable<? extends JavaFileObject> compilationUnits,
Context context) |
int |
isSupportedOption(String option)
Determines if the given option is supported and if so, the
number of arguments the option takes.
|
static void |
processOptions(Context context,
JavaFileManager fileManager,
Iterable<String> options) |
int |
run(InputStream in,
OutputStream out,
OutputStream err,
String... arguments)
Run the tool with the given I/O channels and arguments.
|
@Deprecated public JavacTool()
create()
or the
service provider mechanism.JavaCompiler
,
ToolProvider
,
create()
public static JavacTool create()
public JavacFileManager getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset)
JavaCompiler
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.
getStandardFileManager
in interface JavaCompiler
diagnosticListener
- a diagnostic listener for non-fatal
diagnostics; if null
use the compiler's default method
for reporting diagnosticslocale
- the locale to apply when formatting diagnostics;
null
means the default locale.charset
- the character set used for decoding bytes; if
null
use the platform defaultpublic JavacTask getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits)
JavaCompiler
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.
getTask
in interface JavaCompiler
out
- a Writer for additional output from the compiler;
use System.err
if null
fileManager
- a file manager; if null
use the
compiler's standard filemanagerdiagnosticListener
- a diagnostic listener; if null
use the compiler's default method for reporting
diagnosticsoptions
- compiler options, null
means no optionsclasses
- names of classes to be processed by annotation
processing, null
means no class namescompilationUnits
- the compilation units to compile, null
means no compilation unitspublic JavacTask getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits, Context context)
public static void processOptions(Context context, JavaFileManager fileManager, Iterable<String> options)
public int run(InputStream in, OutputStream out, OutputStream err, String... arguments)
Tool
out
or err
in some unspecified format.public Set<SourceVersion> getSourceVersions()
Tool
getSourceVersions
in interface Tool
public int isSupportedOption(String option)
OptionChecker
isSupportedOption
in interface OptionChecker
option
- an optionCopyright © 2015. All rights reserved.