1 /* |
1 /* |
2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
29 import java.text.BreakIterator; |
29 import java.text.BreakIterator; |
30 import java.util.List; |
30 import java.util.List; |
31 |
31 |
32 import javax.annotation.processing.ProcessingEnvironment; |
32 import javax.annotation.processing.ProcessingEnvironment; |
33 import javax.lang.model.element.Element; |
33 import javax.lang.model.element.Element; |
|
34 import javax.lang.model.element.PackageElement; |
34 import javax.tools.Diagnostic; |
35 import javax.tools.Diagnostic; |
35 import javax.tools.FileObject; |
36 import javax.tools.FileObject; |
36 import javax.tools.JavaCompiler.CompilationTask; |
37 import javax.tools.JavaCompiler.CompilationTask; |
37 |
38 |
38 import com.sun.source.doctree.DocCommentTree; |
39 import com.sun.source.doctree.DocCommentTree; |
125 */ |
126 */ |
126 public abstract DocCommentTree getDocCommentTree(Element e, String relativePath) throws IOException; |
127 public abstract DocCommentTree getDocCommentTree(Element e, String relativePath) throws IOException; |
127 |
128 |
128 /** |
129 /** |
129 * Returns a doc tree path containing the doc comment tree of the given file. |
130 * Returns a doc tree path containing the doc comment tree of the given file. |
130 * The file must be an HTML file, in which case the doc comment tree represents the |
131 * The file must be an HTML file, in which case the doc comment tree represents |
131 * contents of the <body> tag, and any enclosing tags are ignored. |
132 * the contents of the {@code <body>} tag, and any enclosing tags are ignored. |
132 * Returns {@code null} if no doc comment was found. |
133 * Any references to source code elements contained in {@code @see} and |
133 * Future releases may support additional file types. |
134 * {@code {@link}} tags in the doc comment tree will be evaluated in the |
134 * |
135 * context of the given package element. |
135 * @param fileObject the content container |
136 * Returns {@code null} if no doc comment was found. |
136 * @return a doc tree path containing the doc comment read from the given file. |
137 * |
137 * |
138 * @param fileObject a file object encapsulating the HTML content |
138 * @since 9 |
139 * @param packageElement a package element to associate with the given file object |
139 */ |
140 * representing a legacy package.html, null otherwise |
140 public abstract DocTreePath getDocTreePath(FileObject fileObject); |
141 * @return a doc tree path containing the doc comment parsed from the given file |
|
142 * @throws IllegalArgumentException if the fileObject is not an HTML file |
|
143 * |
|
144 * @since 9 |
|
145 */ |
|
146 public abstract DocTreePath getDocTreePath(FileObject fileObject, PackageElement packageElement); |
141 |
147 |
142 /** |
148 /** |
143 * Returns the language model element referred to by the leaf node of the given |
149 * Returns the language model element referred to by the leaf node of the given |
144 * {@link DocTreePath}, or {@code null} if unknown. |
150 * {@link DocTreePath}, or {@code null} if unknown. |
145 * @param path the path for the tree node |
151 * @param path the path for the tree node |