43 * Gets a DocTrees object for a given CompilationTask. |
43 * Gets a DocTrees object for a given CompilationTask. |
44 * @param task the compilation task for which to get the Trees object |
44 * @param task the compilation task for which to get the Trees object |
45 * @throws IllegalArgumentException if the task does not support the Trees API. |
45 * @throws IllegalArgumentException if the task does not support the Trees API. |
46 */ |
46 */ |
47 public static DocTrees instance(CompilationTask task) { |
47 public static DocTrees instance(CompilationTask task) { |
48 if (!task.getClass().getName().equals("com.sun.tools.javac.api.JavacTaskImpl")) |
48 return (DocTrees) Trees.instance(task); |
49 throw new IllegalArgumentException(); |
|
50 return (DocTrees) getJavacTrees(CompilationTask.class, task); |
|
51 } |
49 } |
52 |
50 |
53 /** |
51 /** |
54 * Gets a DocTrees object for a given ProcessingEnvironment. |
52 * Gets a DocTrees object for a given ProcessingEnvironment. |
55 * @param env the processing environment for which to get the Trees object |
53 * @param env the processing environment for which to get the Trees object |