For each combination of options, a separate task/context is created and kept, as most option values are cached inside components themselves.
When the compilation redefines sensitive classes (e.g. classes in the java.* packages), the task/context is not reused.
When the task is reused, then packages that were already listed won't be listed again.
Care must be taken to only return tasks that won't be used by the original caller.
Care must also be taken when custom components are installed, as those are not cleaned when the task/context is reused, and subsequent getTask may return a task based on a context with these custom components.
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.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| public static interface |
| Modifier and Type | Field and Description |
|---|---|
| private static final Queue | |
| private int | |
| private final int | |
| private final Map | |
| private int | |
| private int | |
| private int | |
| private int | |
| private static final JavacTool |
| Access | Constructor and Description |
|---|---|
| public | JavacTaskPool(int
maximum number of tasks/context that will be kept in the pool. maxPoolSize)Creates the pool. |
| Modifier and Type | Method and Description |
|---|---|
| private long | |
| public <Z> Z | Returns: an object representing the compilationa Writer for additional output from the compiler;
use out, JavaFileManager System.err if nulla file manager; if fileManager, DiagnosticListener<? super JavaFileObject> null use the
compiler's standard file managera diagnostic listener; if diagnosticListener, Iterable<String> null use the compiler's default method for reporting
diagnosticscompiler options, options, Iterable<String> null means no optionsnames of classes to be processed by annotation
processing, classes, Iterable<? extends JavaFileObject> null means no class namesthe compilation units to compile, compilationUnits, JavacTaskPool.null means no compilation unitsthat should be run with the task workerCreates a new task as if by |
| public void |
| EMPTY_QUEUE | back to summary |
|---|---|
| private static final Queue<JavacTaskPool. | |
| id | back to summary |
|---|---|
| private int id | |
| maxPoolSize | back to summary |
|---|---|
| private final int maxPoolSize | |
| options2Contexts | back to summary |
|---|---|
| private final Map<List<String>, Queue<JavacTaskPool. | |
| statNew | back to summary |
|---|---|
| private int statNew | |
| statPolluted | back to summary |
|---|---|
| private int statPolluted | |
| statRemoved | back to summary |
|---|---|
| private int statRemoved | |
| statReused | back to summary |
|---|---|
| private int statReused | |
| systemProvider | back to summary |
|---|---|
| private static final JavacTool systemProvider | |
| JavacTaskPool | back to summary |
|---|---|
| public JavacTaskPool(int maxPoolSize) Creates the pool.
| |
| cacheSize | back to summary |
|---|---|
| private long cacheSize() | |
| getTask | back to summary |
|---|---|
| public <Z> Z getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits, JavacTaskPool. Creates a new task as if by
| |
| printStatistics | back to summary |
|---|---|
| public void printStatistics(PrintStream out) | |
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | JavacTaskPool.
Reusable JavaCompiler; exposes a method to clean up the component from leftovers associated with previous compilations. |
| pack-priv static class | JavacTaskPool.
Reusable Log; exposes a method to clean up the component from leftovers associated with previous compilations. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv List | |
| pack-priv boolean | |
| pack-priv TreeScanner | pollutionScanner
This scanner detects as to whether the shared context has been polluted. |
| pack-priv Set | |
| pack-priv long | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv <T> void | |
| pack-priv <T> void | |
| public void | finished(TaskEvent e)
Overrides default com. Invoked when an event has been completed. |
| public void | started(TaskEvent e)
Overrides default com. Invoked when an event has begun. |
| arguments | back to summary |
|---|---|
| pack-priv List<String> arguments | |
| polluted | back to summary |
|---|---|
| pack-priv boolean polluted | |
| pollutionScanner | back to summary |
|---|---|
| pack-priv TreeScanner<Void, Symtab> pollutionScanner This scanner detects as to whether the shared context has been polluted. This happens whenever a compiled program redefines a core class (in 'java.*' package) or when (typically because of cyclic inheritance) the symbol kind of a core class has been touched. | |
| roots | back to summary |
|---|---|
| pack-priv Set<CompilationUnitTree> roots | |
| timeStamp | back to summary |
|---|---|
| pack-priv long timeStamp | |
| useCount | back to summary |
|---|---|
| pack-priv int useCount | |
| ReusableContext | back to summary |
|---|---|
| pack-priv ReusableContext(List<String> arguments) | |
| clear | back to summary |
|---|---|
| pack-priv void clear() | |
| drop | back to summary |
|---|---|
| pack-priv <T> void drop(Context. | |
| drop | back to summary |
|---|---|
| pack-priv <T> void drop(Class<T> c) | |
| finished | back to summary |
|---|---|
| public void finished(TaskEvent e) Overrides default com. Doc from com. Invoked when an event has been completed.
| |
| started | back to summary |
|---|---|
| public void started(TaskEvent e) Overrides default com. Doc from com. Invoked when an event has begun.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final Context. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| pack-priv void | |
| public void |
| factory | back to summary |
|---|---|
| pack-priv static final Context. | |
| ReusableJavaCompiler | back to summary |
|---|---|
| pack-priv ReusableJavaCompiler(Context context) | |
| checkReusable | back to summary |
|---|---|
| protected void checkReusable() Overrides com.
| |
| clear | back to summary |
|---|---|
| pack-priv void clear() | |
| close | back to summary |
|---|---|
| public void close() Overrides com. Doc from com. Close the compiler, flushing the logs
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Context | |
| pack-priv static final Context. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| context | back to summary |
|---|---|
| pack-priv Context context | |
| factory | back to summary |
|---|---|
| pack-priv static final Context. | |
| ReusableLog | back to summary |
|---|---|
| pack-priv ReusableLog(Context context) | |
| clear | back to summary |
|---|---|
| public void clear() Overrides com. Doc from com. Reset the state of this instance.
| |
| withTask | back to summary |
|---|---|
| public Z withTask(JavacTask task) | |