JavaCompiler.CompilationTask (Java SE 10 & JDK 10 ) (original) (raw)
- All Superinterfaces:
[Callable](../../java/util/concurrent/Callable.html "interface in java.util.concurrent")<[Boolean](../../java/lang/Boolean.html "class in java.lang")>
All Known Implementing Classes:[JavacTask](../../com/sun/source/util/JavacTask.html "class in com.sun.source.util")
Enclosing interface:
JavaCompiler
public static interface JavaCompiler.CompilationTask
extends Callable<Boolean>
Interface representing a future for a compilation task. The compilation task has not yet started. To start the task, call the call method.
Before calling the call method, additional aspects of the task can be configured, for example, by calling thesetProcessors method.
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type Method Description void addModules(Iterable<String> moduleNames) Adds root modules to be taken into account during module resolution. Boolean call() Performs this compilation task. void setLocale(Locale locale) Sets the locale to be applied when formatting diagnostics and other localized data. void setProcessors(Iterable<? extends Processor> processors) Sets processors (for annotation processing). Method Detail
* #### addModules void addModules([Iterable](../../java/lang/Iterable.html "interface in java.lang")<[String](../../java/lang/String.html "class in java.lang")> moduleNames) 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. Parameters: `moduleNames` \- the names of the root modules Throws: `[IllegalArgumentException](../../java/lang/IllegalArgumentException.html "class in java.lang")` \- may be thrown for some invalid module names `[IllegalStateException](../../java/lang/IllegalStateException.html "class in java.lang")` \- if the task has started Since: 9 * #### setProcessors void setProcessors([Iterable](../../java/lang/Iterable.html "interface in java.lang")<? extends [Processor](../../javax/annotation/processing/Processor.html "interface in javax.annotation.processing")> processors) Sets processors (for annotation processing). This will bypass the normal discovery mechanism. Parameters: `processors` \- processors (for annotation processing) Throws: `[IllegalStateException](../../java/lang/IllegalStateException.html "class in java.lang")` \- if the task has started * #### setLocale void setLocale([Locale](../../java/util/Locale.html "class in java.util") locale) Sets the locale to be applied when formatting diagnostics and other localized data. Parameters: `locale` \- the locale to apply; `null` means apply no locale Throws: `[IllegalStateException](../../java/lang/IllegalStateException.html "class in java.lang")` \- if the task has started * #### call [Boolean](../../java/lang/Boolean.html "class in java.lang") call() Performs this compilation task. The compilation may only be performed once. Subsequent calls to this method throw IllegalStateException. Specified by: `[call](../../java/util/concurrent/Callable.html#call%28%29)` in interface `[Callable](../../java/util/concurrent/Callable.html "interface in java.util.concurrent")<[Boolean](../../java/lang/Boolean.html "class in java.lang")>` Returns: true if and only all the files compiled without errors; false otherwise Throws: `[RuntimeException](../../java/lang/RuntimeException.html "class in java.lang")` \- if an unrecoverable error occurred in a user-supplied component. The[cause](../../java/lang/Throwable.html#getCause%28%29) will be the error in user code. `[IllegalStateException](../../java/lang/IllegalStateException.html "class in java.lang")` \- if called more than once
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2018, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.