Callable<Boolean>
, JavaCompiler.CompilationTask
public abstract class JavacTask extends Object implements JavaCompiler.CompilationTask
Modifier | Constructor | Description |
---|---|---|
protected |
Constructor for subclasses to call. |
Modifier and Type | Method | Description |
---|---|---|
abstract void |
addTaskListener |
Adds a specified listener so that it receives notification of events describing the progress of this compilation task. |
abstract Iterable |
analyze() |
Completes all analysis. |
abstract Iterable |
generate() |
Generates code. |
abstract Elements |
getElements() |
Returns a utility object for dealing with program elements. |
abstract TypeMirror |
getTypeMirror |
Returns a type mirror of the tree node determined by the specified path. |
abstract Types |
getTypes() |
Returns a utility object for dealing with type mirrors. |
static JavacTask |
instance |
Returns the JavacTask for a ProcessingEnvironment . |
abstract Iterable |
parse() |
Parses the specified files returning a list of abstract syntax trees. |
abstract void |
removeTaskListener |
Removes the specified listener so that it no longer receives notification of events describing the progress of this compilation task. |
void |
setParameterNameProvider |
Sets the specified ParameterNameProvider . |
abstract void |
setTaskListener |
Sets a specified listener to receive notification of events describing the progress of this compilation task. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addModules, call, setLocale, setProcessors
protected JavacTask()
public static JavacTask instance(ProcessingEnvironment processingEnvironment)
JavacTask
for a ProcessingEnvironment
. If the compiler is being invoked using a CompilationTask
, then that task will be returned.processingEnvironment
- the processing environmentJavacTask
for a ProcessingEnvironment
public abstract Iterable<? extends CompilationUnitTree> parse() throws IOException
IOException
- if an unhandled I/O error occurred in the compiler.IllegalStateException
- if the operation cannot be performed at this time.public abstract Iterable<? extends Element> analyze() throws IOException
IOException
- if an unhandled I/O error occurred in the compiler.IllegalStateException
- if the operation cannot be performed at this time.public abstract Iterable<? extends JavaFileObject> generate() throws IOException
IOException
- if an unhandled I/O error occurred in the compiler.IllegalStateException
- if the operation cannot be performed at this time.public abstract void setTaskListener(TaskListener taskListener)
removeTaskListener
for any listener that has been previously set, followed by addTaskListener
for the new listener.taskListener
- the task listenerIllegalStateException
- if the specified listener has already been added.public abstract void addTaskListener(TaskListener taskListener)
taskListener
- the task listenerIllegalStateException
- if the specified listener has already been added.public abstract void removeTaskListener(TaskListener taskListener)
taskListener
- the task listenerpublic void setParameterNameProvider(ParameterNameProvider provider)
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()
.provider
- the providerpublic abstract TypeMirror getTypeMirror(Iterable<? extends Tree> path)
Trees
.path
- the pathpublic abstract Elements getElements()
public abstract Types getTypes()
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.compiler/com/sun/source/util/JavacTask.html