langtools/src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java
author jjg
Fri, 15 Jan 2016 15:40:24 -0800
changeset 35346 c0614a805fad
parent 34916 16043fc1d90b
child 43265 4ec472ee5135
permissions -rw-r--r--
8146208: Add a public DocTreeFactory to the Compiler Tree API Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
     1
/*
35346
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
     2
 * Copyright (c) 2011, 2016, 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
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    30
import java.util.List;
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    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;
33360
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    34
import javax.tools.Diagnostic;
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    35
import javax.tools.FileObject;
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    36
import javax.tools.JavaCompiler.CompilationTask;
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    37
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    38
import com.sun.source.doctree.DocCommentTree;
33360
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    39
import com.sun.source.doctree.DocTree;
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    40
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
 * Provides access to syntax trees for doc comments.
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    43
 *
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    44
 * @since 1.8
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    45
 */
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    46
public abstract class DocTrees extends Trees {
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    47
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    48
     * 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
    49
     * @param task the compilation task for which to get the Trees object
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    50
     * @return the DocTrees object
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    51
     * @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
    52
     */
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    53
    public static DocTrees instance(CompilationTask task) {
14952
d0022ae20516 8004832: Add new doclint package
jjg
parents: 14541
diff changeset
    54
        return (DocTrees) Trees.instance(task);
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    55
    }
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
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    58
     * 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
    59
     * @param env the processing environment for which to get the Trees object
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    60
     * @return the DocTrees object
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    61
     * @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
    62
     */
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    63
    public static DocTrees instance(ProcessingEnvironment env) {
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    64
        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
    65
            throw new IllegalArgumentException();
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    66
        return (DocTrees) getJavacTrees(ProcessingEnvironment.class, env);
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    67
    }
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
    /**
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    70
     * 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
    71
     * documentation comments.
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    72
     * 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
    73
     * @return the break iterator
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    74
     *
34912
954fa9df99c7 8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents: 33424
diff changeset
    75
     * @since 9
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    76
     */
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    77
    public abstract BreakIterator getBreakIterator();
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    78
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    79
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    80
     * Returns the doc comment tree, if any, for the Tree node identified by a given TreePath.
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    81
     * Returns {@code null} if no doc comment was found.
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    82
     * @param path the path for the tree node
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    83
     * @return the doc comment tree
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    84
     */
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    85
    public abstract DocCommentTree getDocCommentTree(TreePath path);
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    86
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    87
    /**
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    88
     * 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
    89
     * 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
    90
     * @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
    91
     * @return the doc comment tree
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    92
     *
34912
954fa9df99c7 8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents: 33424
diff changeset
    93
     * @since 9
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    94
     */
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
    95
    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
    96
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
     * 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
    99
     * 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
   100
     * 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
   101
     * 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
   102
     * 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
   103
     *
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   104
     * @param fileObject the content container
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   105
     * @return the doc comment tree
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   106
     *
34912
954fa9df99c7 8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents: 33424
diff changeset
   107
     * @since 9
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   108
     */
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   109
    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
   110
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
     * 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
   113
     * 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
   114
     * 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
   115
     * 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
   116
     * 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
   117
     * 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
   118
     *
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   119
     * @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
   120
     * @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
   121
     * @return the doc comment tree
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   122
     * @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
   123
     *
34912
954fa9df99c7 8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents: 33424
diff changeset
   124
     * @since 9
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   125
     */
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   126
    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
   127
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   128
    /**
35346
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   129
     * Returns a doc tree path containing the doc comment tree of the given file.
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   130
     * The file must be an HTML file, in which case the doc comment tree represents the
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   131
     * contents of the <body> tag, and any enclosing tags are ignored.
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   132
     * 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
   133
     * Future releases may support additional file types.
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   134
     *
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   135
     * @param fileObject the content container
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   136
     * @return a doc tree path containing the doc comment read from the given file.
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   137
     *
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   138
     * @since 9
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   139
     */
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   140
    public abstract DocTreePath getDocTreePath(FileObject fileObject);
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   141
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   142
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   143
     * Returns the language model element referred to by the leaf node of the given
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   144
     * {@link DocTreePath}, or {@code null} if unknown.
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   145
     * @param path the path for the tree node
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   146
     * @return the element
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   147
     */
17549
65ea6f3b72d9 8009724: Enhance the DocTree API with DocTreePath
jlahoda
parents: 17273
diff changeset
   148
    public abstract Element getElement(DocTreePath path);
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   149
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   150
    /**
33360
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   151
     * Returns the list of {@link DocTree} representing the first sentence of
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   152
     * a comment.
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   153
     *
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   154
     * @param list the DocTree list to interrogate
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   155
     * @return the first sentence
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   156
     *
34912
954fa9df99c7 8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents: 33424
diff changeset
   157
     * @since 9
33360
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   158
     */
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   159
    public abstract List<DocTree> getFirstSentence(List<? extends DocTree> list);
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   160
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
   161
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   162
     * Returns a utility object for accessing the source positions
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   163
     * of documentation tree nodes.
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   164
     * @return the utility object
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   165
     */
17273
d7ec6654aac9 8008174: DocTree API should provide start and end positions for tree nodes
jlahoda
parents: 16303
diff changeset
   166
    public abstract DocSourcePositions getSourcePositions();
d7ec6654aac9 8008174: DocTree API should provide start and end positions for tree nodes
jlahoda
parents: 16303
diff changeset
   167
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   168
    /**
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   169
     * 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
   170
     * tree within the provided compilation unit
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   171
     *
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   172
     * @param kind the kind of message
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   173
     * @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
   174
     * @param t    the tree to use as a position hint
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
   175
     * @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
   176
     * @param root the compilation unit that contains tree
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
    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
   179
            com.sun.source.doctree.DocTree t,
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   180
            com.sun.source.doctree.DocCommentTree c,
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   181
            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
   182
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   183
    /**
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   184
     * 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
   185
     * documentation comments.
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   186
     * @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
   187
     *                      sentence breaker
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   188
     *
34912
954fa9df99c7 8146572: Update "@since 1.9" to "@since 9" to match java.version.specification [langtools]
jjg
parents: 33424
diff changeset
   189
     * @since 9
33424
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   190
     */
e6bd5406e2cf 8132096: Augment the Compiler Tree API to support the new Simplified Doclet API
ksrini
parents: 33360
diff changeset
   191
    public abstract void setBreakIterator(BreakIterator breakiterator);
35346
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   192
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   193
    /**
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   194
     * 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
   195
     * @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
   196
     *
c0614a805fad 8146208: Add a public DocTreeFactory to the Compiler Tree API
jjg
parents: 34916
diff changeset
   197
     * @since 9
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
    public abstract DocTreeFactory getDocTreeFactory();
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
   200
}