src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java
author jjg
Tue, 10 Oct 2017 17:02:52 -0700
changeset 47328 d18df41954ba
parent 47299 56419ec66d4e
child 47850 4a28dc8a86c2
permissions -rw-r--r--
8187521: In some corner cases the javadoc tool can reuse id attribute Reviewed-by: bpatel, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
44297
e03f5fb3714b 8175200: Long method signatures disturb Method Summary table
bpatel
parents: 40606
diff changeset
     2
 * Copyright (c) 1997, 2017, 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: 1787
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: 1787
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: 1787
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    27
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    28
import java.util.List;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    30
import javax.lang.model.element.AnnotationMirror;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    31
import javax.lang.model.element.Element;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    32
import javax.lang.model.element.ElementKind;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    33
import javax.lang.model.element.ExecutableElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    34
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    35
import javax.lang.model.element.VariableElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    36
import javax.lang.model.type.ArrayType;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    37
import javax.lang.model.type.DeclaredType;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    38
import javax.lang.model.type.TypeMirror;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    39
import javax.lang.model.type.TypeVariable;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    40
import javax.lang.model.util.SimpleTypeVisitor9;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    41
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
    42
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    43
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    44
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    45
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    46
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    47
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    48
import static jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl.Kind.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * Print method and constructor info.
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    53
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    54
 *  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: 14259
diff changeset
    55
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    56
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    57
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 * @author Atul M Dambalkar
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    60
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    64
    public AbstractExecutableMemberWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    65
        super(writer, typeElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    public AbstractExecutableMemberWriter(SubWriterHolderWriter writer) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
        super(writer);
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    73
     * Add the type parameters for the executable member.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * @param member the member to write type parameters for.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    76
     * @param htmltree the content tree to which the parameters will be added.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    78
    protected void addTypeParameters(ExecutableElement member, Content htmltree) {
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    79
        Content typeParameters = getTypeParameters(member);
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    80
        if (!typeParameters.isEmpty()) {
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    81
            htmltree.addContent(typeParameters);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
    82
            htmltree.addContent(Contents.SPACE);
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    83
        }
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    84
    }
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    85
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    86
    /**
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    87
     * Get the type parameters for the executable member.
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    88
     *
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    89
     * @param member the member for which to get the type parameters.
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    90
     * @return the type parameters.
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    91
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    92
    protected Content getTypeParameters(ExecutableElement member) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    93
        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, MEMBER_TYPE_PARAMS, member);
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
    94
        return writer.getTypeParameterLinks(linkInfo);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    97
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    98
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    99
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   100
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   101
    protected Content getDeprecatedLink(Element member) {
47299
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   102
        Content deprecatedLinkContent = new ContentBuilder();
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   103
        deprecatedLinkContent.addContent(utils.getFullyQualifiedName(member));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   104
        if (!utils.isConstructor(member)) {
47299
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   105
            deprecatedLinkContent.addContent(".");
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   106
            deprecatedLinkContent.addContent(member.getSimpleName());
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   107
        }
47299
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   108
        String signature = utils.flatSignature((ExecutableElement) member);
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   109
        if (signature.length() > 2) {
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   110
            deprecatedLinkContent.addContent(Contents.ZERO_WIDTH_SPACE);
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   111
        }
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   112
        deprecatedLinkContent.addContent(signature);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   113
47299
56419ec66d4e 8169819: minor cleanup for deprecated page
bpatel
parents: 47284
diff changeset
   114
        return writer.getDocLink(MEMBER, utils.getEnclosingTypeElement(member), member, deprecatedLinkContent);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   117
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   118
     * Add the summary link for the member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   119
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   120
     * @param context the id of the context where the link will be printed
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40303
diff changeset
   121
     * @param te the type element being linked to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   122
     * @param member the member being linked to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   123
     * @param tdSummary the content tree to which the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   124
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   125
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   126
    protected void addSummaryLink(LinkInfoImpl.Kind context, TypeElement te, Element member,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   127
            Content tdSummary) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   128
        ExecutableElement ee = (ExecutableElement)member;
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 21008
diff changeset
   129
        Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   130
                writer.getDocLink(context, te, ee,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   131
                name(ee), false));
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 21008
diff changeset
   132
        Content code = HtmlTree.CODE(memberLink);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   133
        addParameters(ee, false, code, name(ee).length() - 1);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   134
        tdSummary.addContent(code);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   137
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   138
     * Add the inherited summary link for the member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   139
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   140
     * @param te the type element that we should link to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   141
     * @param member the member being linked to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   142
     * @param linksTree the content tree to which the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   143
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   144
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   145
    protected void addInheritedSummaryLink(TypeElement te, Element member, Content linksTree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   146
        linksTree.addContent(writer.getDocLink(MEMBER, te, member, name(member), false));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   149
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   150
     * Add the parameter for the executable member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   151
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   152
     * @param member the member to write parameter for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   153
     * @param param the parameter that needs to be written.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   154
     * @param isVarArg true if this is a link to var arg.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   155
     * @param tree the content tree to which the parameter information will be added.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   156
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   157
    protected void addParam(ExecutableElement member, VariableElement param,
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   158
            boolean isVarArg, Content tree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   159
        Content link = writer.getLink(new LinkInfoImpl(configuration, EXECUTABLE_MEMBER_PARAM,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   160
                param.asType()).varargs(isVarArg));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   161
        tree.addContent(link);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   162
        if(name(param).length() > 0) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   163
            tree.addContent(Contents.SPACE);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   164
            tree.addContent(name(param));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   168
    /**
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   169
     * Add the receiver annotations information.
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   170
     *
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   171
     * @param member the member to write receiver annotations for.
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   172
     * @param rcvrType the receiver type.
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   173
     * @param descList list of annotation description.
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   174
     * @param tree the content tree to which the information will be added.
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   175
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   176
    protected void addReceiverAnnotations(ExecutableElement member, TypeMirror rcvrType,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   177
            List<? extends AnnotationMirror> annotationMirrors, Content tree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   178
        writer.addReceiverAnnotationInfo(member, rcvrType, annotationMirrors, tree);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   179
        tree.addContent(Contents.SPACE);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   180
        tree.addContent(utils.getTypeName(rcvrType, false));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   181
        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, RECEIVER_TYPE, rcvrType);
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   182
        tree.addContent(writer.getTypeParameterLinks(linkInfo));
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   183
        tree.addContent(Contents.SPACE);
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   184
        tree.addContent("this");
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14542
diff changeset
   185
    }
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14542
diff changeset
   186
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14542
diff changeset
   187
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   188
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   189
     * Add all the parameters for the executable member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   190
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   191
     * @param member the member to write parameters for.
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 7681
diff changeset
   192
     * @param htmltree the content tree to which the parameters information will be added.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   193
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   194
    protected void addParameters(ExecutableElement member, Content htmltree, int indentSize) {
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
   195
        addParameters(member, true, htmltree, indentSize);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   198
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   199
     * Add all the parameters for the executable member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   200
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   201
     * @param member the member to write parameters for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   202
     * @param includeAnnotations true if annotation information needs to be added.
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 7681
diff changeset
   203
     * @param htmltree the content tree to which the parameters information will be added.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   204
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   205
    protected void addParameters(ExecutableElement member,
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
   206
            boolean includeAnnotations, Content htmltree, int indentSize) {
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   207
        Content paramTree = new ContentBuilder();
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   208
        String sep = "";
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   209
        List<? extends VariableElement> parameters = member.getParameters();
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 35426
diff changeset
   210
        CharSequence indent = makeSpace(indentSize + 1);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   211
        TypeMirror rcvrType = member.getReceiverType();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   212
        if (includeAnnotations && rcvrType != null && utils.isAnnotated(rcvrType)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   213
            List<? extends AnnotationMirror> annotationMirrors = rcvrType.getAnnotationMirrors();
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   214
            addReceiverAnnotations(member, rcvrType, annotationMirrors, paramTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   215
            sep = "," + DocletConstants.NL + indent;
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 15385
diff changeset
   216
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
        int paramstart;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   218
        for (paramstart = 0; paramstart < parameters.size(); paramstart++) {
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   219
            paramTree.addContent(sep);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   220
            VariableElement param = parameters.get(paramstart);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   221
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   222
            if (param.getKind() != ElementKind.INSTANCE_INIT) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
                if (includeAnnotations) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   224
                    boolean foundAnnotations =
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   225
                            writer.addAnnotationInfo(indent.length(),
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   226
                            member, param, paramTree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   227
                    if (foundAnnotations) {
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   228
                        paramTree.addContent(DocletConstants.NL);
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   229
                        paramTree.addContent(indent);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
                }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   232
                addParam(member, param,
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   233
                    (paramstart == parameters.size() - 1) && member.isVarArgs(), paramTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
                break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   238
        for (int i = paramstart + 1; i < parameters.size(); i++) {
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   239
            paramTree.addContent(",");
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   240
            paramTree.addContent(DocletConstants.NL);
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   241
            paramTree.addContent(indent);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
            if (includeAnnotations) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
                boolean foundAnnotations =
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   244
                        writer.addAnnotationInfo(indent.length(), member, parameters.get(i),
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   245
                        paramTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
                if (foundAnnotations) {
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   247
                    paramTree.addContent(DocletConstants.NL);
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   248
                    paramTree.addContent(indent);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   251
            addParam(member, parameters.get(i), (i == parameters.size() - 1) && member.isVarArgs(),
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   252
                    paramTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
        }
47284
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   254
        if (paramTree.isEmpty()) {
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   255
            htmltree.addContent("()");
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   256
        } else {
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   257
            htmltree.addContent(Contents.ZERO_WIDTH_SPACE);
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   258
            htmltree.addContent("(");
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   259
            htmltree.addContent(paramTree);
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   260
            paramTree.addContent(")");
355349babaf4 8186332: Fix method signature in method summary table
bpatel
parents: 47216
diff changeset
   261
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   264
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   265
     * Add exceptions for the executable member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   266
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   267
     * @param member the member to write exceptions for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   268
     * @param htmltree the content tree to which the exceptions information will be added.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   269
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   270
    protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   271
        List<? extends TypeMirror> exceptions = member.getThrownTypes();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   272
        if (!exceptions.isEmpty()) {
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 35426
diff changeset
   273
            CharSequence indent = makeSpace(indentSize + 1 - 7);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   274
            htmltree.addContent(DocletConstants.NL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   275
            htmltree.addContent(indent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   276
            htmltree.addContent("throws ");
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
   277
            indent = makeSpace(indentSize + 1);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   278
            Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   279
            htmltree.addContent(link);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   280
            for(int i = 1; i < exceptions.size(); i++) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   281
                htmltree.addContent(",");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   282
                htmltree.addContent(DocletConstants.NL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   283
                htmltree.addContent(indent);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   284
                Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   285
                        exceptions.get(i)));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   286
                htmltree.addContent(exceptionLink);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   291
    protected TypeElement implementsMethodInIntfac(ExecutableElement method,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   292
                                                List<TypeElement> intfacs) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   293
        for (TypeElement intf : intfacs) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   294
            List<ExecutableElement> methods = utils.getMethods(intf);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   295
            if (!methods.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   296
                for (ExecutableElement md : methods) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   297
                    if (name(md).equals(name(method)) &&
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   298
                        md.toString().equals(method.toString())) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 21478
diff changeset
   299
                        return intf;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
     * For backward compatibility, include an anchor using the erasures of the
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
     * parameters.  NOTE:  We won't need this method anymore after we fix
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
     * see tags so that they use the type instead of the erasure.
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   312
     * @param executableElement the ExecutableElement to anchor to.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   313
     * @return the 1.4.x style anchor for the executable element.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   315
    protected String getErasureAnchor(ExecutableElement executableElement) {
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47299
diff changeset
   316
        final StringBuilder buf = new StringBuilder(writer.anchorName(executableElement));
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47299
diff changeset
   317
        buf.append("(");
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   318
        List<? extends VariableElement> parameters = executableElement.getParameters();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
        boolean foundTypeVariable = false;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   320
        for (int i = 0; i < parameters.size(); i++) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
            if (i > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
                buf.append(",");
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   324
            TypeMirror t = parameters.get(i).asType();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   325
            SimpleTypeVisitor9<Boolean, Void> stv = new SimpleTypeVisitor9<Boolean, Void>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   326
                boolean foundTypeVariable = false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   327
40606
eb2c81860c86 8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents: 40508
diff changeset
   328
                @Override
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   329
                public Boolean visitArray(ArrayType t, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   330
                    visit(t.getComponentType());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   331
                    buf.append(utils.getDimension(t));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   332
                    return foundTypeVariable;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   333
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   334
40606
eb2c81860c86 8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents: 40508
diff changeset
   335
                @Override
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   336
                public Boolean visitTypeVariable(TypeVariable t, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   337
                    buf.append(utils.asTypeElement(t).getQualifiedName());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   338
                    foundTypeVariable = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   339
                    return foundTypeVariable;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   340
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   341
40606
eb2c81860c86 8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents: 40508
diff changeset
   342
                @Override
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   343
                public Boolean visitDeclared(DeclaredType t, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   344
                    buf.append(utils.getQualifiedTypeName(t));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   345
                    return foundTypeVariable;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   346
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   347
40606
eb2c81860c86 8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents: 40508
diff changeset
   348
                @Override
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   349
                protected Boolean defaultAction(TypeMirror e, Void p) {
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 35426
diff changeset
   350
                    buf.append(e);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   351
                    return foundTypeVariable;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   352
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   353
            };
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   354
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   355
            boolean isTypeVariable = stv.visit(t);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   356
            if (!foundTypeVariable) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   357
                foundTypeVariable = isTypeVariable;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   358
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
        buf.append(")");
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   361
        return foundTypeVariable ? writer.getName(buf.toString()) : null;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
}