langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java
author jjg
Fri, 27 May 2016 13:06:58 -0700
changeset 38617 d93a7f64e231
parent 25874 83c19f00452c
permissions -rw-r--r--
8157606: deprecate com.sun.javadoc API Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 22163
diff changeset
     2
 * Copyright (c) 2003, 2014, 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: 1264
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: 1264
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: 1264
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1264
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1264
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.doclets.internal.toolkit.util;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 5520
diff changeset
    28
import java.util.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 5520
diff changeset
    29
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import com.sun.javadoc.*;
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 22163
diff changeset
    31
import com.sun.tools.doclets.internal.toolkit.Configuration;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import com.sun.tools.doclets.internal.toolkit.taglets.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * Search for the requested documentation.  Inherit documentation if necessary.
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    37
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    38
 *  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: 14258
diff changeset
    39
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    40
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    41
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 */
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 25874
diff changeset
    45
@Deprecated
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
public class DocFinder {
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
     * The class that encapsulates the input.
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
    public static class Input {
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
        /**
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
    53
         * The element to search documentation from.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
         */
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
    55
        public ProgramElementDoc element;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
         * The taglet to search for documentation on behalf of. Null if we want
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
         * to search for overall documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
        public InheritableTaglet taglet = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
         * The id of the tag to retrieve documentation for.
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        public String tagId = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
         * The tag to retrieve documentation for.  This is only used for the
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
         * inheritDoc tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
        public Tag tag = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
         * True if we only want to search for the first sentence.
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
        public boolean isFirstSentence = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
         * True if we are looking for documentation to replace the inheritDocTag.
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
        public boolean isInheritDocTag = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
         * Used to distinguish between type variable param tags and regular
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
         * param tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
        public boolean isTypeVariableParamTag = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
    89
        public Input(ProgramElementDoc element, InheritableTaglet taglet, Tag tag,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
                boolean isFirstSentence, boolean isInheritDocTag) {
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
    91
            this(element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
            this.taglet = taglet;
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
            this.tag = tag;
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
            this.isFirstSentence = isFirstSentence;
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
            this.isInheritDocTag = isInheritDocTag;
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
    98
        public Input(ProgramElementDoc element, InheritableTaglet taglet, String tagId) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
    99
            this(element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
            this.taglet = taglet;
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
            this.tagId = tagId;
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   104
        public Input(ProgramElementDoc element, InheritableTaglet taglet, String tagId,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
            boolean isTypeVariableParamTag) {
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   106
            this(element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
            this.taglet = taglet;
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
            this.tagId = tagId;
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
            this.isTypeVariableParamTag = isTypeVariableParamTag;
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   112
        public Input(ProgramElementDoc element, InheritableTaglet taglet) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   113
            this(element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
            this.taglet = taglet;
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   117
        public Input(ProgramElementDoc element) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   118
            if (element == null)
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   119
                throw new NullPointerException();
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   120
            this.element = element;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   123
        public Input(ProgramElementDoc element, boolean isFirstSentence) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   124
            this(element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
            this.isFirstSentence = isFirstSentence;
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
        public Input copy() {
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   129
            Input clone = new Input(this.element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
            clone.taglet = this.taglet;
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
            clone.tagId = this.tagId;
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
            clone.tag = this.tag;
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
            clone.isFirstSentence = this.isFirstSentence;
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
            clone.isInheritDocTag = this.isInheritDocTag;
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
            clone.isTypeVariableParamTag = this.isTypeVariableParamTag;
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   136
            if (clone.element == null)
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   137
                throw new NullPointerException();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
            return clone;
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * The class that encapsulates the output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    public static class Output {
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
         * The tag that holds the documentation.  Null if documentation
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
         * is not held by a tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
        public Tag holderTag;
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
         * The Doc object that holds the documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        public Doc holder;
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
         * The inherited documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        public Tag[] inlineTags = new Tag[] {};
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
         * False if documentation could not be inherited.
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        public boolean isValidInheritDocTag = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
         * When automatically inheriting throws tags, you sometime must inherit
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   170
         * more than one tag.  For example if the element declares that it throws
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   171
         * IOException and the overridden element has throws tags for IOException and
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
         * ZipException, both tags would be inherited because ZipException is a
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
         * subclass of IOException.  This subclass of DocFinder.Output allows
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
         * multiple tag inheritence.
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
         */
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   176
        public List<Tag> tagList  = new ArrayList<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
    /**
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   180
     * Search for the requested comments in the given element.  If it does not
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   181
     * have comments, return documentation from the overriden element if possible.
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   182
     * If the overriden element does not exist or does not have documentation to
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     * inherit, search for documentation to inherit from implemented methods.
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
     * @param input the input object used to perform the search.
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     * @return an Output object representing the documentation that was found.
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     */
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 22163
diff changeset
   189
    public static Output search(Configuration configuration, Input input) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
        Output output = new Output();
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
        if (input.isInheritDocTag) {
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   192
            //Do nothing because "element" does not have any documentation.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
            //All it has it {@inheritDoc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
        } else if (input.taglet == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
            //We want overall documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
            output.inlineTags = input.isFirstSentence ?
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   197
                input.element.firstSentenceTags() :
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   198
                input.element.inlineTags();
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   199
            output.holder = input.element;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
            input.taglet.inherit(input, output);
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        if (output.inlineTags != null && output.inlineTags.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
            return output;
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
        output.isValidInheritDocTag = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
        Input inheritedSearchInput = input.copy();
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
        inheritedSearchInput.isInheritDocTag = false;
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   210
        if (input.element instanceof MethodDoc) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   211
            MethodDoc overriddenMethod = ((MethodDoc) input.element).overriddenMethod();
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   212
            if (overriddenMethod != null) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   213
                inheritedSearchInput.element = overriddenMethod;
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 22163
diff changeset
   214
                output = search(configuration, inheritedSearchInput);
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   215
                output.isValidInheritDocTag = true;
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   216
                if (output.inlineTags.length > 0) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   217
                    return output;
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   218
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
            }
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   220
            //NOTE:  When we fix the bug where ClassDoc.interfaceTypes() does
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   221
            //       not pass all implemented interfaces, we will use the
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   222
            //       appropriate element here.
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   223
            MethodDoc[] implementedMethods =
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 22163
diff changeset
   224
                (new ImplementedMethods((MethodDoc) input.element, configuration)).build(false);
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17547
diff changeset
   225
            for (MethodDoc implementedMethod : implementedMethods) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 17547
diff changeset
   226
                inheritedSearchInput.element = implementedMethod;
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 22163
diff changeset
   227
                output = search(configuration, inheritedSearchInput);
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   228
                output.isValidInheritDocTag = true;
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   229
                if (output.inlineTags.length > 0) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   230
                    return output;
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   231
                }
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   232
            }
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   233
        } else if (input.element instanceof ClassDoc) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   234
            ProgramElementDoc superclass = ((ClassDoc) input.element).superclass();
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   235
            if (superclass != null) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   236
                inheritedSearchInput.element = superclass;
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 22163
diff changeset
   237
                output = search(configuration, inheritedSearchInput);
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   238
                output.isValidInheritDocTag = true;
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   239
                if (output.inlineTags.length > 0) {
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   240
                    return output;
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 14260
diff changeset
   241
                }
10
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 output;
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
}