langtools/src/share/classes/com/sun/tools/javadoc/Comment.java
author briangoetz
Wed, 18 Dec 2013 16:05:18 -0500
changeset 22163 3651128c74eb
parent 22159 682da512ec17
permissions -rw-r--r--
8030244: Update langtools to use Diamond Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
17545
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
     2
 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.javadoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
17545
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
    28
import java.util.regex.Matcher;
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
    29
import java.util.regex.Pattern;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import com.sun.tools.javac.util.ListBuffer;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * Comment contains all information in comment part.
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 *      It allows users to get first sentence of this comment, get
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 *      comment for different tags...
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 13844
diff changeset
    38
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 13844
diff changeset
    39
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 13844
diff changeset
    40
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 13844
diff changeset
    41
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 13844
diff changeset
    42
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * @author Kaiyang Liu (original)
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * @author Robert Field (rewrite)
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * @author Neal Gafter (rewrite)
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
class Comment {
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     * sorted comments with different tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     */
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
    53
    private final ListBuffer<Tag> tagList = new ListBuffer<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     * text minus any tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
    private String text;
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     * Doc environment
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
    private final DocEnv docenv;
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     * constructor of Comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    Comment(final DocImpl holder, final String commentString) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
        this.docenv = holder.env;
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
         * Separate the comment into the text part and zero to N tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
         * Simple state machine is in one of three states:
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
         * <pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
         * IN_TEXT: parsing the comment text or tag text.
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
         * TAG_NAME: parsing the name of a tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
         * TAG_GAP: skipping through the gap between the tag name and
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
         * the tag text.
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
         * </pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
         */
1870
57a1138dffc8 6795903: fix latent build warnings in langtools repository
jjg
parents: 10
diff changeset
    81
        @SuppressWarnings("fallthrough")
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
        class CommentStringParser {
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
            /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
             * The entry point to the comment string parser
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
             */
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
            void parseCommentStateMachine() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
                final int IN_TEXT = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
                final int TAG_GAP = 2;
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
                final int TAG_NAME = 3;
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
                int state = TAG_GAP;
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
                boolean newLine = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
                String tagName = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
                int tagStart = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
                int textStart = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
                int lastNonWhite = -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
                int len = commentString.length();
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
                for (int inx = 0; inx < len; ++inx) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
                    char ch = commentString.charAt(inx);
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
                    boolean isWhite = Character.isWhitespace(ch);
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
                    switch (state)  {
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
                        case TAG_NAME:
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
                            if (isWhite) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
                                tagName = commentString.substring(tagStart, inx);
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
                                state = TAG_GAP;
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
                            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
                            break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
                        case TAG_GAP:
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
                            if (isWhite) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
                                break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
                            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
                            textStart = inx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
                            state = IN_TEXT;
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
                            /* fall thru */
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
                        case IN_TEXT:
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
                            if (newLine && ch == '@') {
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
                                parseCommentComponent(tagName, textStart,
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
                                                      lastNonWhite+1);
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
                                tagStart = inx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
                                state = TAG_NAME;
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
                            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
                            break;
10203
cca843a7d258 7064544: (javadoc) miscellaneous fixes requested by netbeans
ksrini
parents: 5520
diff changeset
   122
                    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
                    if (ch == '\n') {
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
                        newLine = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
                    } else if (!isWhite) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
                        lastNonWhite = inx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
                        newLine = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
                // Finish what's currently being processed
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
                switch (state)  {
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
                    case TAG_NAME:
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
                        tagName = commentString.substring(tagStart, len);
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
                        /* fall thru */
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
                    case TAG_GAP:
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
                        textStart = len;
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
                        /* fall thru */
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
                    case IN_TEXT:
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
                        parseCommentComponent(tagName, textStart, lastNonWhite+1);
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
                        break;
10203
cca843a7d258 7064544: (javadoc) miscellaneous fixes requested by netbeans
ksrini
parents: 5520
diff changeset
   141
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
            /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
             * Save away the last parsed item.
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
             */
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
            void parseCommentComponent(String tagName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
                                       int from, int upto) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
                String tx = upto <= from ? "" : commentString.substring(from, upto);
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
                if (tagName == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
                    text = tx;
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
                    TagImpl tag;
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   154
                    switch (tagName) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   155
                        case "@exception":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   156
                        case "@throws":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   157
                            warnIfEmpty(tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   158
                            tag = new ThrowsTagImpl(holder, tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   159
                            break;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   160
                        case "@param":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   161
                            warnIfEmpty(tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   162
                            tag = new ParamTagImpl(holder, tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   163
                            break;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   164
                        case "@see":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   165
                            warnIfEmpty(tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   166
                            tag = new SeeTagImpl(holder, tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   167
                            break;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   168
                        case "@serialField":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   169
                            warnIfEmpty(tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   170
                            tag = new SerialFieldTagImpl(holder, tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   171
                            break;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   172
                        case "@return":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   173
                            warnIfEmpty(tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   174
                            tag = new TagImpl(holder, tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   175
                            break;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   176
                        case "@author":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   177
                            warnIfEmpty(tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   178
                            tag = new TagImpl(holder, tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   179
                            break;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   180
                        case "@version":
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   181
                            warnIfEmpty(tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   182
                            tag = new TagImpl(holder, tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   183
                            break;
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   184
                        default:
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   185
                            tag = new TagImpl(holder, tagName, tx);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17545
diff changeset
   186
                            break;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
                    tagList.append(tag);
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
            void warnIfEmpty(String tagName, String tx) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
                if (tx.length() == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
                    docenv.warning(holder, "tag.tag_has_no_arguments", tagName);
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
        new CommentStringParser().parseCommentStateMachine();
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     * Return the text of the comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    String commentText() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
        return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     * Return all tags in this comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
    Tag[] tags() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
        return tagList.toArray(new Tag[tagList.length()]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
     * Return tags of the specified kind in this comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
    Tag[] tags(String tagname) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   221
        ListBuffer<Tag> found = new ListBuffer<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        String target = tagname;
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
        if (target.charAt(0) != '@') {
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
            target = "@" + target;
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
        for (Tag tag : tagList) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
            if (tag.kind().equals(target)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
                found.append(tag);
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
        return found.toArray(new Tag[found.length()]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
     * Return throws tags in this comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
    ThrowsTag[] throwsTags() {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   238
        ListBuffer<ThrowsTag> found = new ListBuffer<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        for (Tag next : tagList) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
            if (next instanceof ThrowsTag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
                found.append((ThrowsTag)next);
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
        return found.toArray(new ThrowsTag[found.length()]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     * Return param tags (excluding type param tags) in this comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
    ParamTag[] paramTags() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
        return paramTags(false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
     * Return type param tags in this comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
    ParamTag[] typeParamTags() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
        return paramTags(true);
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
     * Return param tags in this comment.  If typeParams is true
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
     * include only type param tags, otherwise include only ordinary
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
     * param tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
    private ParamTag[] paramTags(boolean typeParams) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   267
        ListBuffer<ParamTag> found = new ListBuffer<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        for (Tag next : tagList) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
            if (next instanceof ParamTag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
                ParamTag p = (ParamTag)next;
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
                if (typeParams == p.isTypeParameter()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
                    found.append(p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
        return found.toArray(new ParamTag[found.length()]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
     * Return see also tags in this comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
    SeeTag[] seeTags() {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   283
        ListBuffer<SeeTag> found = new ListBuffer<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
        for (Tag next : tagList) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
            if (next instanceof SeeTag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
                found.append((SeeTag)next);
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
        return found.toArray(new SeeTag[found.length()]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
     * Return serialField tags in this comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
    SerialFieldTag[] serialFieldTags() {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   296
        ListBuffer<SerialFieldTag> found = new ListBuffer<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        for (Tag next : tagList) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
            if (next instanceof SerialFieldTag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
                found.append((SerialFieldTag)next);
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
        return found.toArray(new SerialFieldTag[found.length()]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
     * Return array of tags with text and inline See Tags for a Doc comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
    static Tag[] getInlineTags(DocImpl holder, String inlinetext) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   309
        ListBuffer<Tag> taglist = new ListBuffer<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
        int delimend = 0, textstart = 0, len = inlinetext.length();
17545
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   311
        boolean inPre = false;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
        DocEnv docenv = holder.env;
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
        if (len == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
            return taglist.toArray(new Tag[taglist.length()]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
        while (true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
            int linkstart;
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
            if ((linkstart = inlineTagFound(holder, inlinetext,
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
                                            textstart)) == -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
                taglist.append(new TagImpl(holder, "Text",
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
                                           inlinetext.substring(textstart)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
                break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
            } else {
17545
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   325
                inPre = scanForPre(inlinetext, textstart, linkstart, inPre);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
                int seetextstart = linkstart;
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
                for (int i = linkstart; i < inlinetext.length(); i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
                    char c = inlinetext.charAt(i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
                    if (Character.isWhitespace(c) ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
                        c == '}') {
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
                        seetextstart = i;
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
                        break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
                     }
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
                String linkName = inlinetext.substring(linkstart+2, seetextstart);
17545
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   336
                if (!(inPre && (linkName.equals("code") || linkName.equals("literal")))) {
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   337
                    //Move past the white space after the inline tag name.
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   338
                    while (Character.isWhitespace(inlinetext.
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   339
                                                      charAt(seetextstart))) {
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   340
                        if (inlinetext.length() <= seetextstart) {
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   341
                            taglist.append(new TagImpl(holder, "Text",
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   342
                                                       inlinetext.substring(textstart, seetextstart)));
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   343
                            docenv.warning(holder,
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   344
                                           "tag.Improper_Use_Of_Link_Tag",
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   345
                                           inlinetext);
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   346
                            return taglist.toArray(new Tag[taglist.length()]);
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   347
                        } else {
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   348
                            seetextstart++;
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   349
                        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
                taglist.append(new TagImpl(holder, "Text",
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
                                           inlinetext.substring(textstart, linkstart)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
                textstart = seetextstart;   // this text is actually seetag
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
                if ((delimend = findInlineTagDelim(inlinetext, textstart)) == -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
                    //Missing closing '}' character.
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
                    // store the text as it is with the {@link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
                    taglist.append(new TagImpl(holder, "Text",
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
                                               inlinetext.substring(textstart)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
                    docenv.warning(holder,
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
                                   "tag.End_delimiter_missing_for_possible_SeeTag",
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
                                   inlinetext);
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
                    return taglist.toArray(new Tag[taglist.length()]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
                    //Found closing '}' character.
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
                    if (linkName.equals("see")
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
                           || linkName.equals("link")
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
                           || linkName.equals("linkplain")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
                        taglist.append( new SeeTagImpl(holder, "@" + linkName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
                              inlinetext.substring(textstart, delimend)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
                    } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
                        taglist.append( new TagImpl(holder, "@" + linkName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
                              inlinetext.substring(textstart, delimend)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
                    textstart = delimend + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
            if (textstart == inlinetext.length()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
                break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
        return taglist.toArray(new Tag[taglist.length()]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
17545
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   385
    /** regex for case-insensitive match for {@literal <pre> } and  {@literal </pre> }. */
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   386
    private static final Pattern prePat = Pattern.compile("(?i)<(/?)pre>");
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   387
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   388
    private static boolean scanForPre(String inlinetext, int start, int end, boolean inPre) {
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   389
        Matcher m = prePat.matcher(inlinetext).region(start, end);
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   390
        while (m.find()) {
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   391
            inPre = m.group(1).isEmpty();
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   392
        }
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   393
        return inPre;
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   394
    }
bfd4d1aa16ae 8002387: Improve rendered HTML formatting for {@code}
jjg
parents: 14260
diff changeset
   395
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
     * Recursively find the index of the closing '}' character for an inline tag
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
     * and return it.  If it can't be found, return -1.
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
     * @param inlineText the text to search in.
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
     * @param searchStart the index of the place to start searching at.
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
     * @return the index of the closing '}' character for an inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
     * If it can't be found, return -1.
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
    private static int findInlineTagDelim(String inlineText, int searchStart) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
        int delimEnd, nestedOpenBrace;
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
        if ((delimEnd = inlineText.indexOf("}", searchStart)) == -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
            return -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
        } else if (((nestedOpenBrace = inlineText.indexOf("{", searchStart)) != -1) &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
            nestedOpenBrace < delimEnd){
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
            //Found a nested open brace.
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
            int nestedCloseBrace = findInlineTagDelim(inlineText, nestedOpenBrace + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
            return (nestedCloseBrace != -1) ?
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
                findInlineTagDelim(inlineText, nestedCloseBrace + 1) :
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
                -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
            return delimEnd;
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
    /**
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 10203
diff changeset
   421
     * Recursively search for the characters '{', '@', followed by
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   422
     * name of inline tag and white space,
06bc494ca11e Initial load
duke
parents:
diff changeset
   423
     * if found
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
     *    return the index of the text following the white space.
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
     * else
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
     *    return -1.
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
     */
10203
cca843a7d258 7064544: (javadoc) miscellaneous fixes requested by netbeans
ksrini
parents: 5520
diff changeset
   428
    private static int inlineTagFound(DocImpl holder, String inlinetext, int start) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
        DocEnv docenv = holder.env;
10203
cca843a7d258 7064544: (javadoc) miscellaneous fixes requested by netbeans
ksrini
parents: 5520
diff changeset
   430
        int linkstart = inlinetext.indexOf("{@", start);
cca843a7d258 7064544: (javadoc) miscellaneous fixes requested by netbeans
ksrini
parents: 5520
diff changeset
   431
        if (start == inlinetext.length() || linkstart == -1) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
            return -1;
10203
cca843a7d258 7064544: (javadoc) miscellaneous fixes requested by netbeans
ksrini
parents: 5520
diff changeset
   433
        } else if (inlinetext.indexOf('}', linkstart) == -1) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
            //Missing '}'.
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
            docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag",
10203
cca843a7d258 7064544: (javadoc) miscellaneous fixes requested by netbeans
ksrini
parents: 5520
diff changeset
   436
                    inlinetext.substring(linkstart, inlinetext.length()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
            return -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
            return linkstart;
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   442
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
     * Return array of tags for the locale specific first sentence in the text.
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
    static Tag[] firstSentenceTags(DocImpl holder, String text) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
        DocLocale doclocale = holder.env.doclocale;
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
        return getInlineTags(holder,
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
                             doclocale.localeSpecificFirstSentence(holder, text));
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
     * Return text for this Doc comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
     */
10203
cca843a7d258 7064544: (javadoc) miscellaneous fixes requested by netbeans
ksrini
parents: 5520
diff changeset
   456
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
    public String toString() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
        return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
}