50 * @author Peter von der Ahé |
50 * @author Peter von der Ahé |
51 */ |
51 */ |
52 public abstract class Trees { |
52 public abstract class Trees { |
53 /** |
53 /** |
54 * Gets a Trees object for a given CompilationTask. |
54 * Gets a Trees object for a given CompilationTask. |
|
55 * @param task the compilation task for which to get the Trees object |
55 * @throws IllegalArgumentException if the task does not support the Trees API. |
56 * @throws IllegalArgumentException if the task does not support the Trees API. |
56 */ |
57 */ |
57 public static Trees instance(CompilationTask task) { |
58 public static Trees instance(CompilationTask task) { |
58 if (!task.getClass().getName().equals("com.sun.tools.javac.api.JavacTaskImpl")) |
59 if (!task.getClass().getName().equals("com.sun.tools.javac.api.JavacTaskImpl")) |
59 throw new IllegalArgumentException(); |
60 throw new IllegalArgumentException(); |
60 return getJavacTrees(CompilationTask.class, task); |
61 return getJavacTrees(CompilationTask.class, task); |
61 } |
62 } |
62 |
63 |
63 /** |
64 /** |
64 * Gets a Trees object for a given CompilationTask. |
65 * Gets a Trees object for a given ProcessingEnvironment. |
|
66 * @param env the processing environment for which to get the Trees object |
65 * @throws IllegalArgumentException if the env does not support the Trees API. |
67 * @throws IllegalArgumentException if the env does not support the Trees API. |
66 */ |
68 */ |
67 public static Trees instance(ProcessingEnvironment env) { |
69 public static Trees instance(ProcessingEnvironment env) { |
68 if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment")) |
70 if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment")) |
69 throw new IllegalArgumentException(); |
71 throw new IllegalArgumentException(); |