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

public Class BasicJavacTask

extends JavacTask
Class Inheritance
Known Direct Subclasses
com.sun.tools.javac.api.JavacTaskImpl
Imports
java.util.Collection, .LinkedHashSet, .Locale, .Objects, .ServiceLoader, .Set, java.util.stream.Collectors, javax.annotation.processing.Processor, javax.lang.model.element.Element, javax.lang.model.type.TypeMirror, javax.lang.model.util.Elements, .Types, javax.tools.JavaFileObject, com.sun.source.tree.CompilationUnitTree, .Tree, com.sun.source.util.JavacTask, .ParameterNameProvider, .Plugin, .TaskListener, com.sun.tools.doclint.DocLint, com.sun.tools.javac.code.MissingInfoHandler, com.sun.tools.javac.main.JavaCompiler, com.sun.tools.javac.model.JavacElements, .JavacTypes, com.sun.tools.javac.platform.PlatformDescription, .PlatformDescription.PluginInfo, com.sun.tools.javac.processing.JavacProcessingEnvironment, com.sun.tools.javac.resources.CompilerProperties.Errors, .CompilerProperties.Warnings, com.sun.tools.javac.tree.JCTree, com.sun.tools.javac.util.Context, .DefinedBy, .DefinedBy.Api, .List, .Log, .ModuleHelper, .Options, .PropagatedException

Provides basic functionality for implementations of JavacTask.

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.

Field Summary

Modifier and TypeField and Description
protected Context
protected Options
private TaskListener

Constructor Summary

AccessConstructor and Description
public
BasicJavacTask(Context c, boolean register)

Method Summary

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

Implements javax.tools.JavaCompiler.CompilationTask.addModules.

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

public void
addTaskListener(TaskListener taskListener)

Implements abstract com.sun.source.util.JavacTask.addTaskListener.

Adds a specified listener so that it receives notification of events describing the progress of this compilation task.

public Iterable<? extends Element>
analyze()

Implements abstract com.sun.source.util.JavacTask.analyze.

Completes all analysis.

public Boolean
call()

Implements javax.tools.JavaCompiler.CompilationTask.call.

Performs this compilation task.

public Iterable<? extends JavaFileObject>
generate()

Implements abstract com.sun.source.util.JavacTask.generate.

Generates code.

public Context

Returns:

the context
getContext
()

For internal use only.

public Elements
getElements()

Implements abstract com.sun.source.util.JavacTask.getElements.

Returns a utility object for dealing with program elements.

public Collection<TaskListener>
public TypeMirror
getTypeMirror(Iterable<? extends Tree> path)

Implements abstract com.sun.source.util.JavacTask.getTypeMirror.

Returns a type mirror of the tree node determined by the specified path.

public Types
getTypes()

Implements abstract com.sun.source.util.JavacTask.getTypes.

Returns a utility object for dealing with type mirrors.

public void
initDocLint(List<String> docLintOpts)

private void
initPlugin(Plugin p, String... args)

public void
initPlugins(Set<List<String>> pluginOpts)

public static JavacTask
instance(Context context)

public Iterable<? extends CompilationUnitTree>
parse()

Implements abstract com.sun.source.util.JavacTask.parse.

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

public void
removeTaskListener(TaskListener taskListener)

Implements abstract com.sun.source.util.JavacTask.removeTaskListener.

Removes the specified listener so that it no longer receives notification of events describing the progress of this compilation task.

public void
setLocale(Locale locale)

Implements javax.tools.JavaCompiler.CompilationTask.setLocale.

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

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

Implements javax.tools.JavaCompiler.CompilationTask.setProcessors.

Sets processors (for annotation processing).

public void
setTaskListener(TaskListener tl)

Implements abstract com.sun.source.util.JavacTask.setTaskListener.

Sets a specified listener to receive notification of events describing the progress of this compilation task.

Inherited from com.sun.source.util.JavacTask:
instance

Field Detail

contextback to summary
protected Context context
optionsback to summary
protected Options options
taskListenerback to summary
private TaskListener taskListener

Constructor Detail

BasicJavacTaskback to summary
public BasicJavacTask(Context c, boolean register)
Annotations
@SuppressWarnings:this-escape

Method Detail

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

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
addTaskListenerback to summary
public void addTaskListener(TaskListener taskListener)

Implements abstract com.sun.source.util.JavacTask.addTaskListener.

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

Adds a specified listener so that it receives notification of events describing the progress of this compilation task. This method may be called at any time before or during the compilation.

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

Implements abstract com.sun.source.util.JavacTask.analyze.

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

Completes all analysis.

Annotations
@Override
@DefinedBy:COMPILER_TREE
callback to summary
public Boolean 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
generateback to summary
public Iterable<? extends JavaFileObject> generate()

Implements abstract com.sun.source.util.JavacTask.generate.

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

Generates code.

Annotations
@Override
@DefinedBy:COMPILER_TREE
getContextback to summary
public Context getContext()

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

Returns:Context

the context

getElementsback to summary
public Elements getElements()

Implements abstract com.sun.source.util.JavacTask.getElements.

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

Returns a utility object for dealing with program elements.

Annotations
@Override
@DefinedBy:COMPILER_TREE
getTaskListenersback to summary
public Collection<TaskListener> getTaskListeners()
getTypeMirrorback to summary
public TypeMirror getTypeMirror(Iterable<? extends Tree> path)

Implements abstract com.sun.source.util.JavacTask.getTypeMirror.

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

Returns a type mirror of the tree node determined by the specified path. This method has been superseded by methods on Trees.

Annotations
@Override
@DefinedBy:COMPILER_TREE
getTypesback to summary
public Types getTypes()

Implements abstract com.sun.source.util.JavacTask.getTypes.

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

Returns a utility object for dealing with type mirrors.

Annotations
@Override
@DefinedBy:COMPILER_TREE
initDocLintback to summary
public void initDocLint(List<String> docLintOpts)
initPluginback to summary
private void initPlugin(Plugin p, String... args)
initPluginsback to summary
public void initPlugins(Set<List<String>> pluginOpts)
instanceback to summary
public static JavacTask instance(Context context)
parseback to summary
public Iterable<? extends CompilationUnitTree> parse()

Implements abstract com.sun.source.util.JavacTask.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
removeTaskListenerback to summary
public void removeTaskListener(TaskListener taskListener)

Implements abstract com.sun.source.util.JavacTask.removeTaskListener.

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

Removes the specified listener so that it no longer receives notification of events describing the progress of this compilation task. This method may be called at any time before or during the compilation.

Annotations
@Override
@DefinedBy:COMPILER_TREE
setLocaleback to summary
public void setLocale(Locale locale)

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
setParameterNameProviderback to summary
public void setParameterNameProvider(ParameterNameProvider handler)

Overrides com.sun.source.util.JavacTask.setParameterNameProvider.

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

Sets the specified ParameterNameProvider. It may be used when VariableElement#getSimpleName() is called for a method parameter for which an authoritative name is not found. The given ParameterNameProvider may infer a user-friendly name for the method parameter. Setting a new ParameterNameProvider will clear any previously set ParameterNameProvider, which won't be queried any more. When no ParameterNameProvider is set, or when it returns null from ParameterNameProvider#getParameterName(javax.lang.model.element.VariableElement), an automatically synthesized name is returned from VariableElement.getSimpleName().

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

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
setTaskListenerback to summary
public void setTaskListener(TaskListener tl)

Implements abstract com.sun.source.util.JavacTask.setTaskListener.

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

Sets a specified listener to receive notification of events describing the progress of this compilation task. If another listener is receiving notifications as a result of a prior call of this method, then that listener will no longer receive notifications. Informally, this method is equivalent to calling removeTaskListener for any listener that has been previously set, followed by addTaskListener for the new listener.

Annotations
@Override
@DefinedBy:COMPILER_TREE