langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java
author ksrini
Mon, 10 Oct 2016 11:21:00 -0700
changeset 41452 ddaef4bba083
parent 41157 b235a429089a
child 42417 8e1573096052
permissions -rw-r--r--
8165991: Fix DocTreeFactory newDocCommentTree 8154349: New doclet incorrectly shows entire text body for JavaFX properties in summary section Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
     2
 * Copyright (c) 1997, 2016, 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: 2320
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: 2320
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: 2320
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
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: 31943
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    28
import java.util.Arrays;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    29
import java.util.List;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    30
import java.util.SortedSet;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    31
import java.util.TreeSet;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    32
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    33
import javax.lang.model.element.Element;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    34
import javax.lang.model.element.ExecutableElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    35
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    36
import javax.lang.model.type.TypeMirror;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    37
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    38
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    40
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    41
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    42
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    43
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    44
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    45
import jdk.javadoc.internal.doclets.toolkit.MethodWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    46
import jdk.javadoc.internal.doclets.toolkit.util.ImplementedMethods;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    47
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * Writes method documentation in HTML format.
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    52
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    53
 *  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: 7681
diff changeset
    54
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    55
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    56
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 * @author Jamie Ho (rewrite)
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
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 class MethodWriterImpl extends AbstractExecutableMemberWriter
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
        implements MethodWriter, MemberSummaryWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     * Construct a new MethodWriterImpl.
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     * @param writer the writer for the class that the methods belong to.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    69
     * @param typeElement the class being documented.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    71
    public MethodWriterImpl(SubWriterHolderWriter writer, TypeElement typeElement) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    72
        super(writer, typeElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     * Construct a new MethodWriterImpl.
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     * @param writer The writer for the class that the methods belong to.
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    public MethodWriterImpl(SubWriterHolderWriter writer) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
        super(writer);
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    85
     * {@inheritDoc}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    87
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    88
    public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    89
        memberSummaryTree.addContent(HtmlConstants.START_OF_METHOD_SUMMARY);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    90
        Content memberTree = writer.getMemberTreeHeader();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
    91
        writer.addSummaryHeader(this, typeElement, memberTree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    92
        return memberTree;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    96
     * {@inheritDoc}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
    98
    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
    99
        writer.addMemberTree(memberSummaryTree, memberTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   100
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   101
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   102
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   103
     * {@inheritDoc}
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   104
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   105
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   106
    public Content getMethodDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   107
        memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   108
        Content methodDetailsTree = writer.getMemberTreeHeader();
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   109
        methodDetailsTree.addContent(writer.getMarkerAnchor(
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   110
                SectionName.METHOD_DETAIL));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   111
        Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   112
                contents.methodDetailLabel);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   113
        methodDetailsTree.addContent(heading);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   114
        return methodDetailsTree;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   120
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   121
    public Content getMethodDocTreeHeader(ExecutableElement method, Content methodDetailsTree) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
        String erasureAnchor;
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
        if ((erasureAnchor = getErasureAnchor(method)) != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   124
            methodDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   126
        methodDetailsTree.addContent(
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   127
                writer.getMarkerAnchor(writer.getAnchor(method)));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   128
        Content methodDocTree = writer.getMemberTreeHeader();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   129
        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   130
        heading.addContent(name(method));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   131
        methodDocTree.addContent(heading);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   132
        return methodDocTree;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   136
     * Get the signature for the given method.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * @param method the method being documented.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   139
     * @return a content object for the signature
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   141
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   142
    public Content getSignature(ExecutableElement method) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   143
        Content pre = new HtmlTree(HtmlTag.PRE);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   144
        writer.addAnnotationInfo(method, pre);
31943
72b69ab429c9 8062647: Wrong indentation of arguments of annotated methods
igerasim
parents: 29957
diff changeset
   145
        int annotationLength = pre.charCount();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   146
        addModifiers(method, pre);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   147
        addTypeParameters(method, pre);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   148
        addReturnType(method, pre);
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14357
diff changeset
   149
        if (configuration.linksource) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   150
            Content methodName = new StringContent(name(method));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   151
            writer.addSrcLink(method, methodName, pre);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
        } else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   153
            addName(name(method), pre);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
        }
31943
72b69ab429c9 8062647: Wrong indentation of arguments of annotated methods
igerasim
parents: 29957
diff changeset
   155
        int indent = pre.charCount() - annotationLength;
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
   156
        addParameters(method, pre, indent);
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17561
diff changeset
   157
        addExceptions(method, pre, indent);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   158
        return pre;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   162
     * {@inheritDoc}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   164
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   165
    public void addDeprecated(ExecutableElement method, Content methodDocTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   166
        addDeprecatedInfo(method, methodDocTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   170
     * {@inheritDoc}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   172
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   173
    public void addComments(TypeMirror holderType, ExecutableElement method, Content methodDocTree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   174
        TypeElement holder = utils.asTypeElement(holderType);
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 41157
diff changeset
   175
        if (!utils.getFullBody(method).isEmpty()) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   176
            if (holder.equals(typeElement) ||
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   177
                    !(utils.isPublic(holder) ||
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   178
                    utils.isLinkable(holder))) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   179
                writer.addInlineComment(method, methodDocTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
            } else {
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   181
                Content link =
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   182
                        writer.getDocLink(LinkInfoImpl.Kind.EXECUTABLE_ELEMENT_COPY,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   183
                        holder, method,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   184
                        utils.isIncluded(holder)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   185
                                ? utils.getSimpleName(holder)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   186
                                : utils.getFullyQualifiedName(holder),
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   187
                            false);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   188
                Content codelLink = HtmlTree.CODE(link);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   189
                Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   190
                        utils.isClass(holder)
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   191
                                ? contents.descfrmClassLabel
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   192
                                : contents.descfrmInterfaceLabel);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   193
                descfrmLabel.addContent(Contents.SPACE);
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 21008
diff changeset
   194
                descfrmLabel.addContent(codelLink);
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 21008
diff changeset
   195
                methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   196
                writer.addInlineComment(method, methodDocTree);
10
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
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   202
     * {@inheritDoc}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   204
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   205
    public void addTags(ExecutableElement method, Content methodDocTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   206
        writer.addTagsInfo(method, methodDocTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   210
     * {@inheritDoc}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   212
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   213
    public Content getMethodDetails(Content methodDetailsTree) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   214
        if (configuration.allowTag(HtmlTag.SECTION)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   215
            HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(methodDetailsTree));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   216
            return htmlTree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   217
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   218
        return getMemberTree(methodDetailsTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   222
     * {@inheritDoc}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   224
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   225
    public Content getMethodDoc(Content methodDocTree,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   226
            boolean isLastContent) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   227
        return getMemberTree(methodDocTree, isLastContent);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   231
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   232
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   233
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   234
    public void addSummaryLabel(Content memberTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   235
        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   236
                contents.methodSummary);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   237
        memberTree.addContent(label);
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
diff changeset
   238
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
diff changeset
   239
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   240
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   241
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   242
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   243
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   244
    public String getTableSummary() {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   245
        return resources.getText("doclet.Member_Table_Summary",
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   246
                resources.getText("doclet.Method_Summary"),
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   247
                resources.getText("doclet.methods"));
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
diff changeset
   248
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
diff changeset
   249
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   250
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   251
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   252
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   253
    @Override
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17564
diff changeset
   254
    public Content getCaption() {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   255
        return contents.methods;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   256
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   257
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   258
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   259
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   260
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   261
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   262
    public List<String> getSummaryTableHeader(Element member) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   263
        List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
41157
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40303
diff changeset
   264
                resources.getText("doclet.Method"), resources.getText("doclet.Description"));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   265
        return header;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   268
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   269
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   270
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   271
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   272
    public void addSummaryAnchor(TypeElement typeElement, Content memberTree) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   273
        memberTree.addContent(writer.getMarkerAnchor(
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   274
                SectionName.METHOD_SUMMARY));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   277
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   278
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   279
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   280
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   281
    public void addInheritedSummaryAnchor(TypeElement typeElement, Content inheritedTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   282
        inheritedTree.addContent(writer.getMarkerAnchor(
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   283
                SectionName.METHODS_INHERITANCE, configuration.getClassName(typeElement)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   286
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   287
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   288
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   289
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   290
    public void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   291
        Content classLink = writer.getPreQualifiedClassLink(
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   292
                LinkInfoImpl.Kind.MEMBER, typeElement, false);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   293
        Content label = new StringContent(utils.isClass(typeElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   294
                ? configuration.getText("doclet.Methods_Inherited_From_Class")
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   295
                : configuration.getText("doclet.Methods_Inherited_From_Interface"));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   296
        Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   297
                label);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   298
        labelHeading.addContent(Contents.SPACE);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   299
        labelHeading.addContent(classLink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   300
        inheritedTree.addContent(labelHeading);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   303
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   304
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   305
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   306
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   307
    protected void addSummaryType(Element member, Content tdSummaryType) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   308
        ExecutableElement meth = (ExecutableElement)member;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   309
        addModifierAndType(meth, utils.getReturnType(meth), tdSummaryType);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   312
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   313
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   314
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   315
    protected static void addOverridden(HtmlDocletWriter writer,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   316
            TypeMirror overriddenType, ExecutableElement method, Content dl) {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14357
diff changeset
   317
        if (writer.configuration.nocomment) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
        }
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   320
        Utils utils = writer.utils;
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   321
        Contents contents = writer.contents;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   322
        TypeElement holder = utils.getEnclosingTypeElement(method);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   323
        if (!(utils.isPublic(holder) ||
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   324
            utils.isLinkable(holder))) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
            //This is an implementation detail that should not be documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   328
        if (utils.isIncluded(holder) && ! utils.isIncluded(method)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
            //The class is included but the method is not.  That means that it
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
            //is not visible so don't document this.
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
        }
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   333
        Content label = contents.overridesLabel;
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 16964
diff changeset
   334
        LinkInfoImpl.Kind context = LinkInfoImpl.Kind.METHOD_OVERRIDES;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
        if (method != null) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   337
            if (utils.isAbstract(holder) && utils.isAbstract(method)){
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
                //Abstract method is implemented from abstract class,
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
                //not overridden
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   340
                label = contents.specifiedByLabel;
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 16964
diff changeset
   341
                context = LinkInfoImpl.Kind.METHOD_SPECIFIED_BY;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
            }
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 21008
diff changeset
   343
            Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, label));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   344
            dl.addContent(dt);
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   345
            Content overriddenTypeLink =
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   346
                    writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   347
            Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   348
            Content methlink = writer.getLink(
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 16964
diff changeset
   349
                    new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   350
                    holder)
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 35426
diff changeset
   351
                    .where(writer.getName(writer.getAnchor(method))).label(method.getSimpleName()));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   352
            Content codeMethLink = HtmlTree.CODE(methlink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   353
            Content dd = HtmlTree.DD(codeMethLink);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   354
            dd.addContent(Contents.SPACE);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   355
            dd.addContent(writer.contents.inClass);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   356
            dd.addContent(Contents.SPACE);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   357
            dd.addContent(codeOverridenTypeLink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   358
            dl.addContent(dd);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   363
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   364
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   365
    protected static void addImplementsInfo(HtmlDocletWriter writer,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   366
            ExecutableElement method, Content dl) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   367
        if (writer.configuration.nocomment) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   370
        Utils utils = writer.utils;
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   371
        Contents contents = writer.contents;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
        ImplementedMethods implementedMethodsFinder =
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   373
                new ImplementedMethods(method, writer.configuration);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   374
        SortedSet<ExecutableElement> implementedMethods =
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   375
                new TreeSet<>(utils.makeOverrideUseComparator());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   376
        implementedMethods.addAll(implementedMethodsFinder.build());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   377
        for (ExecutableElement implementedMeth : implementedMethods) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   378
            TypeMirror intfac = implementedMethodsFinder.getMethodHolder(implementedMeth);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   379
            intfac = utils.getDeclaredType(utils.getEnclosingTypeElement(method), intfac);
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   380
            Content intfaclink = writer.getLink(new LinkInfoImpl(
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   381
                    writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   382
            Content codeIntfacLink = HtmlTree.CODE(intfaclink);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   383
            Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, contents.specifiedByLabel));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   384
            dl.addContent(dt);
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   385
            Content methlink = writer.getDocLink(
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 16964
diff changeset
   386
                    LinkInfoImpl.Kind.MEMBER, implementedMeth,
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 35426
diff changeset
   387
                    implementedMeth.getSimpleName(), false);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   388
            Content codeMethLink = HtmlTree.CODE(methlink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   389
            Content dd = HtmlTree.DD(codeMethLink);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   390
            dd.addContent(Contents.SPACE);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   391
            dd.addContent(contents.inInterface);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   392
            dd.addContent(Contents.SPACE);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   393
            dd.addContent(codeIntfacLink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   394
            dl.addContent(dd);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   398
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   399
     * Add the return type.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   400
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   401
     * @param method the method being documented.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   402
     * @param htmltree the content tree to which the return type will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   403
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   404
    protected void addReturnType(ExecutableElement method, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   405
        TypeMirror type = utils.getReturnType(method);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   406
        if (type != null) {
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   407
            Content linkContent = writer.getLink(
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   408
                    new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   409
            htmltree.addContent(linkContent);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   410
            htmltree.addContent(Contents.SPACE);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   414
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   415
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   416
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   417
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   418
    protected Content getNavSummaryLink(TypeElement typeElement, boolean link) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
        if (link) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   420
            if (typeElement == null) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   421
                return writer.getHyperLink(
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   422
                        SectionName.METHOD_SUMMARY,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   423
                        contents.navMethod);
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   424
            } else {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   425
                return writer.getHyperLink(
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   426
                        SectionName.METHODS_INHERITANCE,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   427
                        configuration.getClassName(typeElement), contents.navMethod);
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   428
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
        } else {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   430
            return contents.navMethod;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   431
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   432
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   433
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   434
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   435
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   436
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31943
diff changeset
   437
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   438
    protected void addNavDetailLink(boolean link, Content liNav) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   439
        if (link) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19253
diff changeset
   440
            liNav.addContent(writer.getHyperLink(
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   441
                    SectionName.METHOD_DETAIL, contents.navMethod));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   442
        } else {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   443
            liNav.addContent(contents.navMethod);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
}