src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java
author ksrini
Tue, 24 Apr 2018 11:54:03 -0700
changeset 49879 601277b1d582
parent 47216 71c04702a3d5
permissions -rw-r--r--
8025091: VisibleMemberMap.java possible performance improvements 8198890: The standard doclet incorrectly produces wrong method signatures in certain cases. Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
49879
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
     2
 * Copyright (c) 2003, 2018, 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: 1789
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: 1789
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: 1789
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1789
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: 25874
diff changeset
    26
package jdk.javadoc.internal.doclets.toolkit.builders;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
49879
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    28
import java.util.List;
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    29
import javax.lang.model.element.Element;
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    30
import javax.lang.model.element.TypeElement;
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    31
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
    32
import jdk.javadoc.internal.doclets.toolkit.Content;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 35426
diff changeset
    33
import jdk.javadoc.internal.doclets.toolkit.DocletException;
49879
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    34
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    35
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * The superclass for all member builders.  Member builders are only executed
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * within Class Builders.  They essentially build sub-components.  For example,
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * method documentation is a sub-component of class documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    42
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    43
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    44
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    45
 *  deletion without notice.</b>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
public abstract class AbstractMemberBuilder extends AbstractBuilder {
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
49879
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    51
    final protected TypeElement typeElement;
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    52
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    53
    final protected VisibleMemberTable visibleMemberTable;
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    54
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     * Construct a SubBuilder.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 35426
diff changeset
    57
     * @param context a context object, providing information used in this run
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     *        of the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     */
49879
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    60
    public AbstractMemberBuilder(Context context, TypeElement typeElement) {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14260
diff changeset
    61
        super(context);
49879
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    62
        this.typeElement = typeElement;
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    63
        visibleMemberTable = configuration.getVisibleMemberTable(typeElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     * This method is not supported by sub-builders.
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     *
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 35426
diff changeset
    69
     * @throws AssertionError always
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 35426
diff changeset
    71
    @Override
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 35426
diff changeset
    72
    public void build() {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 35426
diff changeset
    73
        // You may not call the build method in a subbuilder.
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 35426
diff changeset
    74
        throw new AssertionError();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    /**
45599
8bc3a019f948 8149146: [javadoc] eliminate doclet.xml
jjg
parents: 45417
diff changeset
    78
     *
8bc3a019f948 8149146: [javadoc] eliminate doclet.xml
jjg
parents: 45417
diff changeset
    79
     * Build the documentation.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     *
45599
8bc3a019f948 8149146: [javadoc] eliminate doclet.xml
jjg
parents: 45417
diff changeset
    81
     * @param contentTree The content tree into which to add the documention
8bc3a019f948 8149146: [javadoc] eliminate doclet.xml
jjg
parents: 45417
diff changeset
    82
     * @throws DocletException  if there is a problem building the documentation
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     */
45599
8bc3a019f948 8149146: [javadoc] eliminate doclet.xml
jjg
parents: 45417
diff changeset
    84
    public abstract void build(Content contentTree) throws DocletException;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
    /**
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 35426
diff changeset
    87
     * Returns true if this subbuilder has anything to document.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     *
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 35426
diff changeset
    89
     * @return true if this subbuilder has anything to document
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    public abstract boolean hasMembersToDocument();
49879
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    92
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    93
    /**
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    94
     * Returns a list of visible elements of the specified kind in this
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    95
     * type element.
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    96
     * @param kind of members
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    97
     * @return a list of members
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    98
     */
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
    99
    protected List<? extends Element> getVisibleMembers(Kind kind) {
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
   100
        return visibleMemberTable.getVisibleMembers(kind);
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 47216
diff changeset
   101
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
}