code: public static Trees instance(CompilationTask task) {
          String taskClassName = task.getClass().getName();
          if (!taskClassName.equals("com.sun.tools.javac.api.JavacTaskImpl")
                  && !taskClassName.equals("com.sun.tools.javac.api.BasicJavacTask"))
              throw new IllegalArgumentException();
          return getJavacTrees(CompilationTask.class, task);
      }
docs: Returns a Trees object for a given CompilationTask.
  @param task the compilation task for which to get the Trees object
  @throws IllegalArgumentException if the task does not support the Trees API.
  @return the Trees object