20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.source.util;
27
28 import javax.annotation.processing.ProcessingEnvironment;
29 import javax.lang.model.element.Element;
30 import javax.tools.JavaCompiler.CompilationTask;
31
32 import com.sun.source.doctree.DocCommentTree;
33 import javax.tools.Diagnostic;
34
35 /**
36 * Provides access to syntax trees for doc comments.
37 *
38 * @since 1.8
39 */
40 @jdk.Supported
41 public abstract class DocTrees extends Trees {
42 /**
43 * Gets a DocTrees object for a given CompilationTask.
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.
46 */
47 public static DocTrees instance(CompilationTask task) {
48 return (DocTrees) Trees.instance(task);
49 }
50
51 /**
52 * Gets a DocTrees object for a given ProcessingEnvironment.
53 * @param env the processing environment for which to get the Trees object
54 * @throws IllegalArgumentException if the env does not support the Trees API.
55 */
56 public static DocTrees instance(ProcessingEnvironment env) {
57 if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
58 throw new IllegalArgumentException();
59 return (DocTrees) getJavacTrees(ProcessingEnvironment.class, env);
60 }
|
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.source.util;
27
28 import javax.annotation.processing.ProcessingEnvironment;
29 import javax.lang.model.element.Element;
30 import javax.tools.JavaCompiler.CompilationTask;
31
32 import com.sun.source.doctree.DocCommentTree;
33 import javax.tools.Diagnostic;
34
35 /**
36 * Provides access to syntax trees for doc comments.
37 *
38 * @since 1.8
39 */
40 @jdk.Exported
41 public abstract class DocTrees extends Trees {
42 /**
43 * Gets a DocTrees object for a given CompilationTask.
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.
46 */
47 public static DocTrees instance(CompilationTask task) {
48 return (DocTrees) Trees.instance(task);
49 }
50
51 /**
52 * Gets a DocTrees object for a given ProcessingEnvironment.
53 * @param env the processing environment for which to get the Trees object
54 * @throws IllegalArgumentException if the env does not support the Trees API.
55 */
56 public static DocTrees instance(ProcessingEnvironment env) {
57 if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
58 throw new IllegalArgumentException();
59 return (DocTrees) getJavacTrees(ProcessingEnvironment.class, env);
60 }
|