use of org.eclipse.ceylon.langtools.tools.javac.api.BasicJavacTask in project ceylon by eclipse.
the class JavacTask method instance.
/**
* Get the {@code JavacTask} for a {@code ProcessingEnvironment}.
* If the compiler is being invoked using a
* {@link org.eclipse.ceylon.javax.tools.JavaCompiler.CompilationTask CompilationTask},
* then that task will be returned.
* @param processingEnvironment the processing environment
* @return the {@code JavacTask} for a {@code ProcessingEnvironment}
* @since 1.8
*/
public static JavacTask instance(ProcessingEnvironment processingEnvironment) {
if (!processingEnvironment.getClass().getName().equals("org.eclipse.ceylon.langtools.tools.javac.processing.JavacProcessingEnvironment"))
throw new IllegalArgumentException();
Context c = ((JavacProcessingEnvironment) processingEnvironment).getContext();
JavacTask t = c.get(JavacTask.class);
return (t != null) ? t : new BasicJavacTask(c, true);
}
Aggregations