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

public Class JavacTaskImpl

extends BasicJavacTask
Class Inheritance
Imports
java.io.IOException, java.nio.CharBuffer, java.util.*, java.util.concurrent.Callable, java.util.concurrent.atomic.AtomicBoolean, javax.annotation.processing.Processor, javax.lang.model.element.Element, .TypeElement, javax.tools.*, com.sun.source.tree.*, com.sun.tools.javac.code.*, .DeferredCompletionFailureHandler.Handler, .Symbol.ClassSymbol, com.sun.tools.javac.comp.*, com.sun.tools.javac.file.BaseFileManager, com.sun.tools.javac.main.*, .JavaCompiler, com.sun.tools.javac.parser.Parser, .ParserFactory, com.sun.tools.javac.processing.AnnotationProcessingError, com.sun.tools.javac.tree.*, .JCTree.JCClassDecl, .JCTree.JCCompilationUnit, .JCTree.JCModuleDecl, .JCTree.Tag, com.sun.tools.javac.util.*, .DefinedBy.Api, .List, .Log.PrefixKind, .Log.WriterKind

Provides access to functionality specific to the JDK Java Compiler, javac.

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.

Authors
Peter von der Ahé, Jonathan Gibbons

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract class

Field Summary

Modifier and TypeField and Description
private ListBuffer<String>
private final Arguments
private JavaCompiler
private DeferredCompletionFailureHandler
private JavaFileManager
private ListBuffer<Env<AttrContext>>
private Locale
private Map<JavaFileObject, JCTree.JCCompilationUnit>
private boolean
private Iterable<? extends Processor>
private final AtomicBoolean
Inherited from com.sun.tools.javac.api.BasicJavacTask:
contextoptions

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
addModules(Iterable<String> moduleNames)

Overrides com.sun.tools.javac.api.BasicJavacTask.addModules.

Implements javax.tools.JavaCompiler.CompilationTask.addModules.

Adds root modules to be taken into account during module resolution.

public Iterable<? extends Element>
analyze()

Overrides com.sun.tools.javac.api.BasicJavacTask.analyze.

Completes all analysis.

public Iterable<? extends Element>

Returns:

the elements that were analyzed
analyze
(Iterable<? extends Element>
a list of class elements
classes
)

Complete all analysis on the given classes.

public Boolean
pack-priv void
public Main.Result
public void
public Iterable<? extends Element>

Returns:

a list of elements corresponding to the top level classes in the abstract syntax trees
enter
()

Translate all the abstract syntax trees to elements.

public Iterable<? extends Element>

Returns:

a list of elements corresponding to the top level classes in the abstract syntax trees
enter
(Iterable<? extends CompilationUnitTree>
a list of abstract syntax trees.
trees
)

Translate the given abstract syntax trees to elements.

public Iterable<? extends JavaFileObject>
public Iterable<? extends JavaFileObject>

Returns:

the files that were generated
generate
(Iterable<? extends Element>
a list of class elements
classes
)

Generate code corresponding to the given classes.

private void
private <T> Pair<T, Throwable>
public Iterable<? extends CompilationUnitTree>
parse()

Overrides com.sun.tools.javac.api.BasicJavacTask.parse.

Parses the specified files returning a list of abstract syntax trees.

private Iterable<? extends CompilationUnitTree>
public Type

Returns:

the type
parseType
(String
the type expression to be analyzed
expr
,
TypeElement
the scope in which to analyze the type expression
scope
)

For internal use only.

private void
prepareCompiler(boolean forParse)

public void
setLocale(Locale locale)

Overrides com.sun.tools.javac.api.BasicJavacTask.setLocale.

Implements javax.tools.JavaCompiler.CompilationTask.setLocale.

Sets the locale to be applied when formatting diagnostics and other localized data.

public void
setProcessors(Iterable<? extends Processor> processors)

Overrides com.sun.tools.javac.api.BasicJavacTask.setProcessors.

Implements javax.tools.JavaCompiler.CompilationTask.setProcessors.

Sets processors (for annotation processing).

pack-priv <T> String
toString(Iterable<T> items, String sep)

Inherited from com.sun.tools.javac.api.BasicJavacTask:
addTaskListenergetContextgetElementsgetTaskListenersgetTypeMirrorgetTypesinitDocLintinitPluginsinstanceremoveTaskListenersetParameterNameProvidersetTaskListener

Field Detail

addModulesback to summary
private ListBuffer<String> addModules
argsback to summary
private final Arguments args
compilerback to summary
private JavaCompiler compiler
dcfhback to summary
private DeferredCompletionFailureHandler dcfh
fileManagerback to summary
private JavaFileManager fileManager
genListback to summary
private ListBuffer<Env<AttrContext>> genList
localeback to summary
private Locale locale
notYetEnteredback to summary
private Map<JavaFileObject, JCTree.JCCompilationUnit> notYetEntered
parsedback to summary
private boolean parsed
processorsback to summary
private Iterable<? extends Processor> processors
usedback to summary
private final AtomicBoolean used

Constructor Detail

JavacTaskImplback to summary
protected JavacTaskImpl(Context context)

Method Detail

addModulesback to summary
public void addModules(Iterable<String> moduleNames)

Overrides com.sun.tools.javac.api.BasicJavacTask.addModules.

Implements javax.tools.JavaCompiler.CompilationTask.addModules.

Doc from javax.tools.JavaCompiler.CompilationTask.addModules.

Adds root modules to be taken into account during module resolution. Invalid module names may cause either IllegalArgumentException to be thrown, or diagnostics to be reported when the task is started.

Annotations
@Override
@DefinedBy:COMPILER
analyzeback to summary
public Iterable<? extends Element> analyze()

Overrides com.sun.tools.javac.api.BasicJavacTask.analyze.

Doc from com.sun.source.util.JavacTask.analyze.

Completes all analysis.

Annotations
@Override
@DefinedBy:COMPILER_TREE
analyzeback to summary
public Iterable<? extends Element> analyze(Iterable<? extends Element> classes)

Complete all analysis on the given classes. This can be used to ensure that all compile time errors are reported. The classes must have previously been returned from enter. If null is specified, all outstanding classes will be analyzed.

Parameters
classes:Iterable<? extends Element>

a list of class elements

Returns:Iterable<? extends Element>

the elements that were analyzed

callback to summary
public Boolean call()

Overrides com.sun.tools.javac.api.BasicJavacTask.call.

Implements javax.tools.JavaCompiler.CompilationTask.call.

Doc from javax.tools.JavaCompiler.CompilationTask.call.

Performs this compilation task. The compilation may only be performed once. Subsequent calls to this method throw IllegalStateException.

Annotations
@Override
@DefinedBy:COMPILER
cleanupback to summary
pack-priv void cleanup()
doCallback to summary
public Main.Result doCall()
ensureEnteredback to summary
public void ensureEntered()
enterback to summary
public Iterable<? extends Element> enter()

Translate all the abstract syntax trees to elements.

Returns:Iterable<? extends Element>

a list of elements corresponding to the top level classes in the abstract syntax trees

enterback to summary
public Iterable<? extends Element> enter(Iterable<? extends CompilationUnitTree> trees)

Translate the given abstract syntax trees to elements.

Parameters
trees:Iterable<? extends CompilationUnitTree>

a list of abstract syntax trees.

Returns:Iterable<? extends Element>

a list of elements corresponding to the top level classes in the abstract syntax trees

generateback to summary
public Iterable<? extends JavaFileObject> generate()

Overrides com.sun.tools.javac.api.BasicJavacTask.generate.

Doc from com.sun.source.util.JavacTask.generate.

Generates code.

Annotations
@Override
@DefinedBy:COMPILER_TREE
generateback to summary
public Iterable<? extends JavaFileObject> generate(Iterable<? extends Element> classes)

Generate code corresponding to the given classes. The classes must have previously been returned from enter. If there are classes outstanding to be analyzed, that will be done before any classes are generated. If null is specified, code will be generated for all outstanding classes.

Parameters
classes:Iterable<? extends Element>

a list of class elements

Returns:Iterable<? extends JavaFileObject>

the files that were generated

handleFlowResultsback to summary
private void handleFlowResults(Queue<Env<AttrContext>> queue, ListBuffer<Element> elems)
invocationHelperback to summary
private <T> Pair<T, Throwable> invocationHelper(Callable<T> c)
parseback to summary
public Iterable<? extends CompilationUnitTree> parse()

Overrides com.sun.tools.javac.api.BasicJavacTask.parse.

Doc from com.sun.source.util.JavacTask.parse.

Parses the specified files returning a list of abstract syntax trees.

Annotations
@Override
@DefinedBy:COMPILER_TREE
parseInternalback to summary
private Iterable<? extends CompilationUnitTree> parseInternal()
parseTypeback to summary
public Type parseType(String expr, TypeElement scope)

For internal use only. This method will be removed without warning.

Parameters
expr:String

the type expression to be analyzed

scope:TypeElement

the scope in which to analyze the type expression

Returns:Type

the type

Exceptions
IllegalArgumentException:
if the type expression of null or empty
prepareCompilerback to summary
private void prepareCompiler(boolean forParse)
setLocaleback to summary
public void setLocale(Locale locale)

Overrides com.sun.tools.javac.api.BasicJavacTask.setLocale.

Implements javax.tools.JavaCompiler.CompilationTask.setLocale.

Doc from javax.tools.JavaCompiler.CompilationTask.setLocale.

Sets the locale to be applied when formatting diagnostics and other localized data.

Annotations
@Override
@DefinedBy:COMPILER
setProcessorsback to summary
public void setProcessors(Iterable<? extends Processor> processors)

Overrides com.sun.tools.javac.api.BasicJavacTask.setProcessors.

Implements javax.tools.JavaCompiler.CompilationTask.setProcessors.

Doc from javax.tools.JavaCompiler.CompilationTask.setProcessors.

Sets processors (for annotation processing). This will bypass the normal discovery mechanism.

Annotations
@Override
@DefinedBy:COMPILER
toStringback to summary
pack-priv <T> String toString(Iterable<T> items, String sep)
com.sun.tools.javac.api back to summary

pack-priv abstract Class JavacTaskImpl.Filter

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract void
pack-priv void
run(Queue<Env<AttrContext>> list, Iterable<? extends Element> elements)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Filterback to summary
pack-priv Filter()

Method Detail

processback to summary
pack-priv abstract void process(Env<AttrContext> env)
runback to summary
pack-priv void run(Queue<Env<AttrContext>> list, Iterable<? extends Element> elements)