author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 43265 | langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java@4ec472ee5135 |
child 48028 | 9e022f580a9d |
permissions | -rw-r--r-- |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
1 |
/* |
43265
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
2 |
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
4 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
10 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
15 |
* accompanied this code). |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
16 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
20 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
23 |
* questions. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
24 |
*/ |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
25 |
|
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
26 |
package com.sun.source.util; |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
27 |
|
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
28 |
import java.io.IOException; |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
29 |
import java.text.BreakIterator; |
33360 | 30 |
import java.util.List; |
31 |
||
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
32 |
import javax.annotation.processing.ProcessingEnvironment; |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
33 |
import javax.lang.model.element.Element; |
43265
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
34 |
import javax.lang.model.element.PackageElement; |
33360 | 35 |
import javax.tools.Diagnostic; |
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
36 |
import javax.tools.FileObject; |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
37 |
import javax.tools.JavaCompiler.CompilationTask; |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
38 |
|
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
39 |
import com.sun.source.doctree.DocCommentTree; |
33360 | 40 |
import com.sun.source.doctree.DocTree; |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
41 |
|
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
42 |
/** |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
43 |
* Provides access to syntax trees for doc comments. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
44 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
45 |
* @since 1.8 |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
46 |
*/ |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
47 |
public abstract class DocTrees extends Trees { |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
48 |
/** |
25287 | 49 |
* Returns a DocTrees object for a given CompilationTask. |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
50 |
* @param task the compilation task for which to get the Trees object |
25287 | 51 |
* @return the DocTrees object |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
52 |
* @throws IllegalArgumentException if the task does not support the Trees API. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
53 |
*/ |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
54 |
public static DocTrees instance(CompilationTask task) { |
14952 | 55 |
return (DocTrees) Trees.instance(task); |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
56 |
} |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
57 |
|
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
58 |
/** |
25287 | 59 |
* Returns a DocTrees object for a given ProcessingEnvironment. |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
60 |
* @param env the processing environment for which to get the Trees object |
25287 | 61 |
* @return the DocTrees object |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
62 |
* @throws IllegalArgumentException if the env does not support the Trees API. |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
63 |
*/ |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
64 |
public static DocTrees instance(ProcessingEnvironment env) { |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
65 |
if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment")) |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
66 |
throw new IllegalArgumentException(); |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
67 |
return (DocTrees) getJavacTrees(ProcessingEnvironment.class, env); |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
68 |
} |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
69 |
|
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
70 |
/** |
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
71 |
* Returns the break iterator used to compute the first sentence of |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
72 |
* documentation comments. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
73 |
* Returns {@code null} if none has been specified. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
74 |
* @return the break iterator |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
75 |
* |
34912
954fa9df99c7
8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents:
33424
diff
changeset
|
76 |
* @since 9 |
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
77 |
*/ |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
78 |
public abstract BreakIterator getBreakIterator(); |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
79 |
|
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
80 |
/** |
25287 | 81 |
* Returns the doc comment tree, if any, for the Tree node identified by a given TreePath. |
82 |
* Returns {@code null} if no doc comment was found. |
|
83 |
* @param path the path for the tree node |
|
84 |
* @return the doc comment tree |
|
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
85 |
*/ |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
86 |
public abstract DocCommentTree getDocCommentTree(TreePath path); |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
87 |
|
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
88 |
/** |
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
89 |
* Returns the doc comment tree of the given element. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
90 |
* Returns {@code null} if no doc comment was found. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
91 |
* @param e an element whose documentation is required |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
92 |
* @return the doc comment tree |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
93 |
* |
34912
954fa9df99c7
8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents:
33424
diff
changeset
|
94 |
* @since 9 |
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
95 |
*/ |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
96 |
public abstract DocCommentTree getDocCommentTree(Element e); |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
97 |
|
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
98 |
/** |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
99 |
* Returns the doc comment tree of the given file. The file must be |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
100 |
* an HTML file, in which case the doc comment tree represents the |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
101 |
* contents of the <body> tag, and any enclosing tags are ignored. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
102 |
* Returns {@code null} if no doc comment was found. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
103 |
* Future releases may support additional file types. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
104 |
* |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
105 |
* @param fileObject the content container |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
106 |
* @return the doc comment tree |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
107 |
* |
34912
954fa9df99c7
8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents:
33424
diff
changeset
|
108 |
* @since 9 |
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
109 |
*/ |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
110 |
public abstract DocCommentTree getDocCommentTree(FileObject fileObject); |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
111 |
|
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
112 |
/** |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
113 |
* Returns the doc comment tree of the given file whose path is |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
114 |
* specified relative to the given element. The file must be an HTML |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
115 |
* file, in which case the doc comment tree represents the contents |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
116 |
* of the <body> tag, and any enclosing tags are ignored. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
117 |
* Returns {@code null} if no doc comment was found. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
118 |
* Future releases may support additional file types. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
119 |
* |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
120 |
* @param e an element whose path is used as a reference |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
121 |
* @param relativePath the relative path from the Element |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
122 |
* @return the doc comment tree |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
123 |
* @throws java.io.IOException if an exception occurs |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
124 |
* |
34912
954fa9df99c7
8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents:
33424
diff
changeset
|
125 |
* @since 9 |
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
126 |
*/ |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
127 |
public abstract DocCommentTree getDocCommentTree(Element e, String relativePath) throws IOException; |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
128 |
|
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
129 |
/** |
35346
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
130 |
* Returns a doc tree path containing the doc comment tree of the given file. |
43265
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
131 |
* The file must be an HTML file, in which case the doc comment tree represents |
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
132 |
* the contents of the {@code <body>} tag, and any enclosing tags are ignored. |
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
133 |
* Any references to source code elements contained in {@code @see} and |
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
134 |
* {@code {@link}} tags in the doc comment tree will be evaluated in the |
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
135 |
* context of the given package element. |
35346
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
136 |
* Returns {@code null} if no doc comment was found. |
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
137 |
* |
43265
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
138 |
* @param fileObject a file object encapsulating the HTML content |
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
139 |
* @param packageElement a package element to associate with the given file object |
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
140 |
* representing a legacy package.html, null otherwise |
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
141 |
* @return a doc tree path containing the doc comment parsed from the given file |
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
142 |
* @throws IllegalArgumentException if the fileObject is not an HTML file |
35346
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
143 |
* |
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
144 |
* @since 9 |
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
145 |
*/ |
43265
4ec472ee5135
8169608: Compiler Tree API's Doctrees.getDocTreePath needs to accept a PackageElement
ksrini
parents:
35346
diff
changeset
|
146 |
public abstract DocTreePath getDocTreePath(FileObject fileObject, PackageElement packageElement); |
35346
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
147 |
|
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
148 |
/** |
25287 | 149 |
* Returns the language model element referred to by the leaf node of the given |
150 |
* {@link DocTreePath}, or {@code null} if unknown. |
|
151 |
* @param path the path for the tree node |
|
152 |
* @return the element |
|
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
153 |
*/ |
17549
65ea6f3b72d9
8009724: Enhance the DocTree API with DocTreePath
jlahoda
parents:
17273
diff
changeset
|
154 |
public abstract Element getElement(DocTreePath path); |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
155 |
|
25287 | 156 |
/** |
33360 | 157 |
* Returns the list of {@link DocTree} representing the first sentence of |
158 |
* a comment. |
|
159 |
* |
|
160 |
* @param list the DocTree list to interrogate |
|
161 |
* @return the first sentence |
|
162 |
* |
|
34912
954fa9df99c7
8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents:
33424
diff
changeset
|
163 |
* @since 9 |
33360 | 164 |
*/ |
165 |
public abstract List<DocTree> getFirstSentence(List<? extends DocTree> list); |
|
166 |
||
167 |
/** |
|
25287 | 168 |
* Returns a utility object for accessing the source positions |
169 |
* of documentation tree nodes. |
|
170 |
* @return the utility object |
|
171 |
*/ |
|
17273
d7ec6654aac9
8008174: DocTree API should provide start and end positions for tree nodes
jlahoda
parents:
16303
diff
changeset
|
172 |
public abstract DocSourcePositions getSourcePositions(); |
d7ec6654aac9
8008174: DocTree API should provide start and end positions for tree nodes
jlahoda
parents:
16303
diff
changeset
|
173 |
|
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
174 |
/** |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
175 |
* Prints a message of the specified kind at the location of the |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
176 |
* tree within the provided compilation unit |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
177 |
* |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
178 |
* @param kind the kind of message |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
179 |
* @param msg the message, or an empty string if none |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
180 |
* @param t the tree to use as a position hint |
25287 | 181 |
* @param c the doc comment tree to use as a position hint |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
182 |
* @param root the compilation unit that contains tree |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
183 |
*/ |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
184 |
public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg, |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
185 |
com.sun.source.doctree.DocTree t, |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
186 |
com.sun.source.doctree.DocCommentTree c, |
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
187 |
com.sun.source.tree.CompilationUnitTree root); |
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
188 |
|
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
189 |
/** |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
190 |
* Sets the break iterator to compute the first sentence of |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
191 |
* documentation comments. |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
192 |
* @param breakiterator a break iterator or {@code null} to specify the default |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
193 |
* sentence breaker |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
194 |
* |
34912
954fa9df99c7
8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents:
33424
diff
changeset
|
195 |
* @since 9 |
33424
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
196 |
*/ |
e6bd5406e2cf
8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents:
33360
diff
changeset
|
197 |
public abstract void setBreakIterator(BreakIterator breakiterator); |
35346
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
198 |
|
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
199 |
/** |
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
200 |
* Returns a utility object for creating {@code DocTree} objects. |
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
201 |
* @return a utility object for creating {@code DocTree} objects |
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
202 |
* |
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
203 |
* @since 9 |
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
204 |
*/ |
c0614a805fad
8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents:
34916
diff
changeset
|
205 |
public abstract DocTreeFactory getDocTreeFactory(); |
14541
36f9d11fc9aa
7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff
changeset
|
206 |
} |