26 package com.sun.source.util;
27
28 import java.io.IOException;
29 import java.text.BreakIterator;
30 import java.util.List;
31
32 import javax.annotation.processing.ProcessingEnvironment;
33 import javax.lang.model.element.Element;
34 import javax.tools.Diagnostic;
35 import javax.tools.FileObject;
36 import javax.tools.JavaCompiler.CompilationTask;
37
38 import com.sun.source.doctree.DocCommentTree;
39 import com.sun.source.doctree.DocTree;
40
41 /**
42 * Provides access to syntax trees for doc comments.
43 *
44 * @since 1.8
45 */
46 @jdk.Exported
47 public abstract class DocTrees extends Trees {
48 /**
49 * Returns a DocTrees object for a given CompilationTask.
50 * @param task the compilation task for which to get the Trees object
51 * @return the DocTrees object
52 * @throws IllegalArgumentException if the task does not support the Trees API.
53 */
54 public static DocTrees instance(CompilationTask task) {
55 return (DocTrees) Trees.instance(task);
56 }
57
58 /**
59 * Returns a DocTrees object for a given ProcessingEnvironment.
60 * @param env the processing environment for which to get the Trees object
61 * @return the DocTrees object
62 * @throws IllegalArgumentException if the env does not support the Trees API.
63 */
64 public static DocTrees instance(ProcessingEnvironment env) {
65 if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
66 throw new IllegalArgumentException();
|
26 package com.sun.source.util;
27
28 import java.io.IOException;
29 import java.text.BreakIterator;
30 import java.util.List;
31
32 import javax.annotation.processing.ProcessingEnvironment;
33 import javax.lang.model.element.Element;
34 import javax.tools.Diagnostic;
35 import javax.tools.FileObject;
36 import javax.tools.JavaCompiler.CompilationTask;
37
38 import com.sun.source.doctree.DocCommentTree;
39 import com.sun.source.doctree.DocTree;
40
41 /**
42 * Provides access to syntax trees for doc comments.
43 *
44 * @since 1.8
45 */
46 public abstract class DocTrees extends Trees {
47 /**
48 * Returns a DocTrees object for a given CompilationTask.
49 * @param task the compilation task for which to get the Trees object
50 * @return the DocTrees object
51 * @throws IllegalArgumentException if the task does not support the Trees API.
52 */
53 public static DocTrees instance(CompilationTask task) {
54 return (DocTrees) Trees.instance(task);
55 }
56
57 /**
58 * Returns a DocTrees object for a given ProcessingEnvironment.
59 * @param env the processing environment for which to get the Trees object
60 * @return the DocTrees object
61 * @throws IllegalArgumentException if the env does not support the Trees API.
62 */
63 public static DocTrees instance(ProcessingEnvironment env) {
64 if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
65 throw new IllegalArgumentException();
|