code: public static JavacTask instance(ProcessingEnvironment processingEnvironment) {
          if (!processingEnvironment.getClass().getName().equals(
                  "com.sun.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);
      }
docs: Returns the {@code JavacTask} for a {@code ProcessingEnvironment}.
  If the compiler is being invoked using a
  {@link 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