langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/DocCommentTree.java
author ksrini
Fri, 11 Sep 2015 16:34:24 -0700
changeset 33360 d8ef08003d35
parent 25874 83c19f00452c
child 34912 954fa9df99c7
permissions -rw-r--r--
8078320: Improve DocTrees parsing. Reviewed-by: jjg, jlahoda
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
/*
33360
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
     2
 * Copyright (c) 2011, 2015, 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.doctree;
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    27
33360
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    28
import java.util.ArrayList;
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    29
import java.util.List;
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    30
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    31
/**
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    32
 * The top level representation of a documentation comment.
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    33
 *
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    34
 * <p>
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    35
 * first-sentence body block-tags
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    36
 *
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    37
 * @since 1.8
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    38
 */
20612
4761f3ff7afb 8025913: Rename jdk.Supported to jdk.Exported
darcy
parents: 16303
diff changeset
    39
@jdk.Exported
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    40
public interface DocCommentTree extends DocTree {
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    41
    /**
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    42
     * Returns the first sentence of a documentation comment.
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    43
     * @return the first sentence of a documentation comment
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    44
     */
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    45
    List<? extends DocTree> getFirstSentence();
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    46
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    47
    /**
33360
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    48
     * Returns the entire body of a documentation comment, appearing
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    49
     * before any block tags, including the first sentence.
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    50
     * @return body of a documentation comment first sentence inclusive
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    51
     *
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    52
     * @since 1.9
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    53
     */
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    54
    default List<? extends DocTree> getFullBody() {
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    55
        ArrayList<DocTree> bodyList = new ArrayList<>();
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    56
        bodyList.addAll(getFirstSentence());
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    57
        bodyList.addAll(getBody());
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    58
        return bodyList;
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    59
    }
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    60
d8ef08003d35 8078320: Improve DocTrees parsing.
ksrini
parents: 25874
diff changeset
    61
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    62
     * Returns the body of a documentation comment,
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    63
     * appearing after the first sentence, and before any block tags.
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    64
     * @return the body of a documentation comment
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    65
     */
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    66
    List<? extends DocTree> getBody();
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    67
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    68
    /**
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    69
     * Returns the block tags for a documentation comment.
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    70
     * @return the block tags of a documentation comment
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 20612
diff changeset
    71
     */
14541
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    72
    List<? extends DocTree> getBlockTags();
36f9d11fc9aa 7021614: extend com.sun.source API to support parsing javadoc comments
jjg
parents:
diff changeset
    73
}