langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
author briangoetz
Wed, 18 Dec 2013 10:29:25 -0500
changeset 22159 682da512ec17
parent 22153 f9f06fcca59d
child 22163 3651128c74eb
permissions -rw-r--r--
8030253: Update langtools to use strings-in-switch 8030262: Update langtools to use foreach loops 8030245: Update langtools to use try-with-resources and multi-catch Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
     2
 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 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
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.internal.toolkit.util;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 5520
diff changeset
    28
import java.util.*;
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
    29
import java.util.regex.Pattern;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 5520
diff changeset
    30
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import com.sun.tools.doclets.internal.toolkit.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * A data structure that encapsulates the visible members of a particular
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * type for a given class tree.  To use this data structor, you must specify
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * the type of member you are interested in (nested class, field, constructor
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * or method) and the leaf of the class tree.  The data structure will map
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * all visible members in the leaf and classes above the leaf in the tree.
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    41
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    42
 *  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
    43
 *  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
    44
 *  deletion without notice.</b>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * @author Jamie Ho (rewrite)
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
public class VisibleMemberMap {
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
    private boolean noVisibleMembers = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
    public static final int INNERCLASSES    = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
    public static final int ENUM_CONSTANTS  = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    public static final int FIELDS          = 2;
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    public static final int CONSTRUCTORS    = 3;
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    public static final int METHODS         = 4;
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 16319
diff changeset
    58
    public static final int ANNOTATION_TYPE_FIELDS = 5;
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 16319
diff changeset
    59
    public static final int ANNOTATION_TYPE_MEMBER_OPTIONAL = 6;
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 16319
diff changeset
    60
    public static final int ANNOTATION_TYPE_MEMBER_REQUIRED = 7;
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 16319
diff changeset
    61
    public static final int PROPERTIES      = 8;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
     * The total number of member types is {@value}.
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     */
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 16319
diff changeset
    66
    public static final int NUM_MEMBER_TYPES = 9;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    public static final String STARTLEVEL = "start";
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     * List of ClassDoc objects for which ClassMembers objects are built.
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    73
    private final List<ClassDoc> visibleClasses = new ArrayList<ClassDoc>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     * Map for each member name on to a map which contains members with same
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     * name-signature. The mapped map will contain mapping for each MemberDoc
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     * onto it's respecive level string.
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    80
    private final Map<Object,Map<ProgramElementDoc,String>> memberNameMap = new HashMap<Object,Map<ProgramElementDoc,String>>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     * Map of class and it's ClassMembers object.
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
    85
    private final Map<ClassDoc,ClassMembers> classMap = new HashMap<ClassDoc,ClassMembers>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     * Type whose visible members are requested.  This is the leaf of
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
     * the class tree being mapped.
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    private final ClassDoc classdoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     * Member kind: InnerClasses/Fields/Methods?
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
    private final int kind;
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    /**
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
    99
     * The configuration this VisibleMemberMap was created with.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     */
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   101
    private final Configuration configuration;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   102
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   103
    private static final Map<ClassDoc, ProgramElementDoc[]> propertiesCache =
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   104
            new HashMap<ClassDoc, ProgramElementDoc[]>();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   105
    private static final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap =
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   106
            new HashMap<ProgramElementDoc, ProgramElementDoc>();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   107
    private static final Map<ProgramElementDoc, GetterSetter> getterSetterMap =
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   108
            new HashMap<ProgramElementDoc, GetterSetter>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * Construct a VisibleMemberMap of the given type for the given
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   112
     * class.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     * @param classdoc the class whose members are being mapped.
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     * @param kind the kind of member that is being mapped.
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   116
     * @param configuration the configuration to use to construct this
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   117
     * VisibleMemberMap. If the field configuration.nodeprecated is true the
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   118
     * deprecated members are excluded from the map. If the field
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   119
     * configuration.javafx is true the JavaFX features are used.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     */
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   121
    public VisibleMemberMap(ClassDoc classdoc,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   122
                            int kind,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   123
                            Configuration configuration) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        this.classdoc = classdoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        this.kind = kind;
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   126
        this.configuration = configuration;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
        new ClassMembers(classdoc, STARTLEVEL).build();
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * Return the list of visible classes in this map.
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * @return the list of visible classes in this map.
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
   135
    public List<ClassDoc> getVisibleClassesList() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
        sort(visibleClasses);
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        return visibleClasses;
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    /**
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   141
     * Returns the property field documentation belonging to the given member.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   142
     * @param ped the member for which the property documentation is needed.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   143
     * @return the property field documentation, null if there is none.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   144
     */
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   145
    public ProgramElementDoc getPropertyMemberDoc(ProgramElementDoc ped) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   146
        return classPropertiesMap.get(ped);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   147
    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   148
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   149
    /**
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   150
     * Returns the getter documentation belonging to the given property method.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   151
     * @param propertyMethod the method for which the getter is needed.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   152
     * @return the getter documentation, null if there is none.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   153
     */
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   154
    public ProgramElementDoc getGetterForProperty(ProgramElementDoc propertyMethod) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   155
        return getterSetterMap.get(propertyMethod).getGetter();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   156
    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   157
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   158
    /**
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   159
     * Returns the setter documentation belonging to the given property method.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   160
     * @param propertyMethod the method for which the setter is needed.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   161
     * @return the setter documentation, null if there is none.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   162
     */
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   163
    public ProgramElementDoc getSetterForProperty(ProgramElementDoc propertyMethod) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   164
        return getterSetterMap.get(propertyMethod).getSetter();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   165
    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   166
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   167
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     * Return the package private members inherited by the class.  Only return
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     * if parent is package private and not documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   171
     * @param configuration the current configuration of the doclet.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
     * @return the package private members inherited by the class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   174
    private List<ProgramElementDoc> getInheritedPackagePrivateMethods(Configuration configuration) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   175
        List<ProgramElementDoc> results = new ArrayList<ProgramElementDoc>();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   176
        for (ClassDoc currentClass : visibleClasses) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
            if (currentClass != classdoc &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
                currentClass.isPackagePrivate() &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
                !Util.isLinkable(currentClass, configuration)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
                // Document these members in the child class because
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
                // the parent is inaccessible.
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
                results.addAll(getMembersFor(currentClass));
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
        return results;
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * Return the visible members of the class being mapped.  Also append at the
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     * end of the list members that are inherited by inaccessible parents. We
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     * document these members in the child because the parent is not documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   193
     * @param configuration the current configuration of the doclet.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   195
    public List<ProgramElementDoc> getLeafClassMembers(Configuration configuration) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   196
        List<ProgramElementDoc> result = getMembersFor(classdoc);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
        result.addAll(getInheritedPackagePrivateMethods(configuration));
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
        return result;
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     * Retrn the list of members for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     * @param cd the class to retrieve the list of visible members for.
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
     * @return the list of members for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   208
    public List<ProgramElementDoc> getMembersFor(ClassDoc cd) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   209
        ClassMembers clmembers = classMap.get(cd);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
        if (clmembers == null) {
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   211
            return new ArrayList<ProgramElementDoc>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
        return clmembers.getMembers();
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
     * Sort the given mixed list of classes and interfaces to a list of
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
     * classes followed by interfaces traversed. Don't sort alphabetically.
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   220
    private void sort(List<ClassDoc> list) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   221
        List<ClassDoc> classes = new ArrayList<ClassDoc>();
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   222
        List<ClassDoc> interfaces = new ArrayList<ClassDoc>();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   223
        for (ClassDoc cd : list) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
            if (cd.isClass()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
                classes.add(cd);
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   226
            }
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   227
            else {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
                interfaces.add(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
        list.clear();
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
        list.addAll(classes);
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        list.addAll(interfaces);
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   236
    private void fillMemberLevelMap(List<ProgramElementDoc> list, String level) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   237
        for (ProgramElementDoc element : list) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   238
            Object key = getMemberKey(element);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   239
            Map<ProgramElementDoc, String> memberLevelMap = memberNameMap.get(key);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
            if (memberLevelMap == null) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   241
                memberLevelMap = new HashMap<ProgramElementDoc, String>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
                memberNameMap.put(key, memberLevelMap);
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
            }
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   244
            memberLevelMap.put(element, level);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
   248
    private void purgeMemberLevelMap(List<ProgramElementDoc> list, String level) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   249
        for (ProgramElementDoc element : list) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   250
            Object key = getMemberKey(element);
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
   251
            Map<ProgramElementDoc, String> memberLevelMap = memberNameMap.get(key);
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   252
            if (level.equals(memberLevelMap.get(element)))
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   253
                memberLevelMap.remove(element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
     * Represents a class member.  We should be able to just use a
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
     * ProgramElementDoc instead of this class, but that doesn't take
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
     * type variables in consideration when comparing.
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
    private class ClassMember {
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   263
        private Set<ProgramElementDoc> members;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
        public ClassMember(ProgramElementDoc programElementDoc) {
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   266
            members = new HashSet<ProgramElementDoc>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
            members.add(programElementDoc);
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
        public void addMember(ProgramElementDoc programElementDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
            members.add(programElementDoc);
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
        public boolean isEqual(MethodDoc member) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   275
            for (ProgramElementDoc element : members) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   276
                if (Util.executableMembersEqual(member, (MethodDoc) element)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
                    members.add(member);
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   278
                    return true;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
     * A data structure that represents the class members for
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
     * a visible class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
    private class ClassMembers {
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
         * The mapping class, whose inherited members are put in the
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
         * {@link #members} list.
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
        private ClassDoc mappingClass;
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
         * List of inherited members from the mapping class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
         */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   300
        private List<ProgramElementDoc> members = new ArrayList<ProgramElementDoc>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
         * Level/Depth of inheritance.
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
        private String level;
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
         * Return list of inherited members from mapping class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
         *
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
         * @return List Inherited members.
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
         */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   312
        public List<ProgramElementDoc> getMembers() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
            return members;
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
        private ClassMembers(ClassDoc mappingClass, String level) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
            this.mappingClass = mappingClass;
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
            this.level = level;
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
            if (classMap.containsKey(mappingClass) &&
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   320
                        level.startsWith(classMap.get(mappingClass).level)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
                //Remove lower level class so that it can be replaced with
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
                //same class found at higher level.
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
                purgeMemberLevelMap(getClassMembers(mappingClass, false),
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   324
                    classMap.get(mappingClass).level);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
                classMap.remove(mappingClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
                visibleClasses.remove(mappingClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
            if (!classMap.containsKey(mappingClass)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
                classMap.put(mappingClass, this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
                visibleClasses.add(mappingClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
        private void build() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
            if (kind == CONSTRUCTORS) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
                addMembers(mappingClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
                mapClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
        private void mapClass() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
            addMembers(mappingClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
            ClassDoc[] interfaces = mappingClass.interfaces();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   346
            for (ClassDoc anInterface : interfaces) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
                String locallevel = level + 1;
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   348
                ClassMembers cm = new ClassMembers(anInterface, locallevel);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
                cm.mapClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
            if (mappingClass.isClass()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
                ClassDoc superclass = mappingClass.superclass();
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
                if (!(superclass == null || mappingClass.equals(superclass))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
                    ClassMembers cm = new ClassMembers(superclass,
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
                                                       level + "c");
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
                    cm.mapClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
            }
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
         * Get all the valid members from the mapping class. Get the list of
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
         * members for the class to be included into(ctii), also get the level
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
         * string for ctii. If mapping class member is not already in the
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
         * inherited member list and if it is visible in the ctii and not
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
         * overridden, put such a member in the inherited member list.
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
         * Adjust member-level-map, class-map.
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
        private void addMembers(ClassDoc fromClass) {
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   370
            List<ProgramElementDoc> cdmembers = getClassMembers(fromClass, true);
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   371
            List<ProgramElementDoc> incllist = new ArrayList<ProgramElementDoc>();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   372
            for (ProgramElementDoc pgmelem : cdmembers) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
                if (!found(members, pgmelem) &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
                    memberIsVisible(pgmelem) &&
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   375
                    !isOverridden(pgmelem, level) &&
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   376
                    !isTreatedAsPrivate(pgmelem)) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   377
                    incllist.add(pgmelem);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
            if (incllist.size() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
                noVisibleMembers = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
            members.addAll(incllist);
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
            fillMemberLevelMap(getClassMembers(fromClass, false), level);
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   387
        private boolean isTreatedAsPrivate(ProgramElementDoc pgmelem) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   388
            if (!configuration.javafx) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   389
                return false;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   390
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   391
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   392
            Tag[] aspTags = pgmelem.tags("@treatAsPrivate");
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   393
            boolean result = (aspTags != null) && (aspTags.length > 0);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   394
            return result;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   395
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   396
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
         * Is given doc item visible in given classdoc in terms fo inheritance?
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
         * The given doc item is visible in the given classdoc if it is public
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
         * or protected and if it is package-private if it's containing class
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
         * is in the same package as the given classdoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
        private boolean memberIsVisible(ProgramElementDoc pgmdoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
            if (pgmdoc.containingClass().equals(classdoc)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
                //Member is in class that we are finding visible members for.
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
                //Of course it is visible.
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
                return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
            } else if (pgmdoc.isPrivate()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
                //Member is in super class or implemented interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
                //Private, so not inherited.
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
                return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
            } else if (pgmdoc.isPackagePrivate()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
                //Member is package private.  Only return true if its class is in
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
                //same package.
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
                return pgmdoc.containingClass().containingPackage().equals(
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
                    classdoc.containingPackage());
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
                //Public members are always inherited.
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
                return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   422
06bc494ca11e Initial load
duke
parents:
diff changeset
   423
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
         * Return all available class members.
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
         */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   426
        private List<ProgramElementDoc> getClassMembers(ClassDoc cd, boolean filter) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
            if (cd.isEnum() && kind == CONSTRUCTORS) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
                //If any of these rules are hit, return empty array because
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
                //we don't document these members ever.
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
                return Arrays.asList(new ProgramElementDoc[] {});
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
            ProgramElementDoc[] members = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
            switch (kind) {
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 16319
diff changeset
   434
                case ANNOTATION_TYPE_FIELDS:
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 16319
diff changeset
   435
                    members = cd.fields(filter);
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 16319
diff changeset
   436
                    break;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
                case ANNOTATION_TYPE_MEMBER_OPTIONAL:
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
                    members = cd.isAnnotationType() ?
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
                        filter((AnnotationTypeDoc) cd, false) :
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
                        new AnnotationTypeElementDoc[] {};
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   442
                case ANNOTATION_TYPE_MEMBER_REQUIRED:
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
                    members = cd.isAnnotationType() ?
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
                        filter((AnnotationTypeDoc) cd, true) :
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
                        new AnnotationTypeElementDoc[] {};
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
                case INNERCLASSES:
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
                    members = cd.innerClasses(filter);
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
                case ENUM_CONSTANTS:
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
                    members = cd.enumConstants();
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
                case FIELDS:
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
                    members = cd.fields(filter);
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
                case CONSTRUCTORS:
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
                    members = cd.constructors();
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
                case METHODS:
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
                    members = cd.methods(filter);
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   461
                    checkOnPropertiesTags((MethodDoc[])members);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   462
                    break;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   463
                case PROPERTIES:
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   464
                    members = properties(cd, filter);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   466
                default:
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
                    members = new ProgramElementDoc[0];
06bc494ca11e Initial load
duke
parents:
diff changeset
   468
            }
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   469
            // Deprected members should be excluded or not?
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   470
            if (configuration.nodeprecated) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
                return Util.excludeDeprecatedMembersAsList(members);
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
            return Arrays.asList(members);
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
         * Filter the annotation type members and return either the required
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
         * members or the optional members, depending on the value of the
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
         * required parameter.
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
         *
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
         * @param doc The annotation type to process.
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
         * @param required
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
         * @return the annotation type members and return either the required
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
         * members or the optional members, depending on the value of the
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
         * required parameter.
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
        private AnnotationTypeElementDoc[] filter(AnnotationTypeDoc doc,
06bc494ca11e Initial load
duke
parents:
diff changeset
   488
            boolean required) {
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   489
            AnnotationTypeElementDoc[] members = doc.elements();
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   490
            List<AnnotationTypeElementDoc> targetMembers = new ArrayList<AnnotationTypeElementDoc>();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   491
            for (AnnotationTypeElementDoc member : members) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   492
                if ((required && member.defaultValue() == null) ||
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   493
                    ((!required) && member.defaultValue() != null)) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   494
                    targetMembers.add(member);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   496
            }
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   497
            return targetMembers.toArray(new AnnotationTypeElementDoc[]{});
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   498
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   499
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
   500
        private boolean found(List<ProgramElementDoc> list, ProgramElementDoc elem) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   501
            for (ProgramElementDoc pgmelem : list) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   502
                if (Util.matches(pgmelem, elem)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   503
                    return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   504
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   505
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   506
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   507
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
06bc494ca11e Initial load
duke
parents:
diff changeset
   509
06bc494ca11e Initial load
duke
parents:
diff changeset
   510
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   511
         * Is member overridden? The member is overridden if it is found in the
06bc494ca11e Initial load
duke
parents:
diff changeset
   512
         * same level hierarchy e.g. member at level "11" overrides member at
06bc494ca11e Initial load
duke
parents:
diff changeset
   513
         * level "111".
06bc494ca11e Initial load
duke
parents:
diff changeset
   514
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   515
        private boolean isOverridden(ProgramElementDoc pgmdoc, String level) {
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1264
diff changeset
   516
            Map<?,String> memberLevelMap = (Map<?,String>) memberNameMap.get(getMemberKey(pgmdoc));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   517
            if (memberLevelMap == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
                return false;
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   519
            for (String mappedlevel : memberLevelMap.values()) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   520
                if (mappedlevel.equals(STARTLEVEL) ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   521
                    (level.startsWith(mappedlevel) &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   522
                     !level.equals(mappedlevel))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
                    return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   524
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   525
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   526
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   527
        }
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   528
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   529
        private ProgramElementDoc[] properties(final ClassDoc cd, final boolean filter) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   530
            final MethodDoc[] allMethods = cd.methods(filter);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   531
            final FieldDoc[] allFields = cd.fields(false);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   532
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   533
            if (propertiesCache.containsKey(cd)) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   534
                return propertiesCache.get(cd);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   535
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   536
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   537
            final List<MethodDoc> result = new ArrayList<MethodDoc>();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   538
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   539
            for (final MethodDoc propertyMethod : allMethods) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   540
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   541
                if (!isPropertyMethod(propertyMethod)) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   542
                    continue;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   543
                }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   544
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   545
                final MethodDoc getter = getterForField(allMethods, propertyMethod);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   546
                final MethodDoc setter = setterForField(allMethods, propertyMethod);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   547
                final FieldDoc field = fieldForProperty(allFields, propertyMethod);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   548
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   549
                addToPropertiesMap(setter, getter, propertyMethod, field);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   550
                getterSetterMap.put(propertyMethod, new GetterSetter(getter, setter));
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   551
                result.add(propertyMethod);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   552
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   553
            final ProgramElementDoc[] resultAray =
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   554
                    result.toArray(new ProgramElementDoc[result.size()]);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   555
            propertiesCache.put(cd, resultAray);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   556
            return resultAray;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   557
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   558
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   559
        private void addToPropertiesMap(MethodDoc setter,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   560
                                        MethodDoc getter,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   561
                                        MethodDoc propertyMethod,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   562
                                        FieldDoc field) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   563
            if ((field == null)
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   564
                    || (field.getRawCommentText() == null)
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   565
                    || field.getRawCommentText().length() == 0) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   566
                addToPropertiesMap(setter, propertyMethod);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   567
                addToPropertiesMap(getter, propertyMethod);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   568
                addToPropertiesMap(propertyMethod, propertyMethod);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   569
            } else {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   570
                addToPropertiesMap(getter, field);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   571
                addToPropertiesMap(setter, field);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   572
                addToPropertiesMap(propertyMethod, field);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   573
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   574
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   575
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   576
        private void addToPropertiesMap(ProgramElementDoc propertyMethod,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   577
                                        ProgramElementDoc commentSource) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   578
            if (null == propertyMethod || null == commentSource) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   579
                return;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   580
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   581
            final String methodRawCommentText = propertyMethod.getRawCommentText();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   582
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   583
            /* The second condition is required for the property buckets. In
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   584
             * this case the comment is at the property method (not at the field)
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   585
             * and it needs to be listed in the map.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   586
             */
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   587
            if ((null == methodRawCommentText || 0 == methodRawCommentText.length())
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   588
                    || propertyMethod.equals(commentSource)) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   589
                classPropertiesMap.put(propertyMethod, commentSource);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   590
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   591
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   592
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   593
        private MethodDoc getterForField(MethodDoc[] methods,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   594
                                         MethodDoc propertyMethod) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   595
            final String propertyMethodName = propertyMethod.name();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   596
            final String fieldName =
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   597
                    propertyMethodName.substring(0,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   598
                            propertyMethodName.lastIndexOf("Property"));
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   599
            final String fieldNameUppercased =
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   600
                    "" + Character.toUpperCase(fieldName.charAt(0))
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   601
                                            + fieldName.substring(1);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   602
            final String getterNamePattern;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   603
            final String fieldTypeName = propertyMethod.returnType().toString();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   604
            if ("boolean".equals(fieldTypeName)
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   605
                    || fieldTypeName.endsWith("BooleanProperty")) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   606
                getterNamePattern = "(is|get)" + fieldNameUppercased;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   607
            } else {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   608
                getterNamePattern = "get" + fieldNameUppercased;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   609
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   610
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   611
            for (MethodDoc methodDoc : methods) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   612
                if (Pattern.matches(getterNamePattern, methodDoc.name())) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   613
                    if (0 == methodDoc.parameters().length
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   614
                            && (methodDoc.isPublic() || methodDoc.isProtected())) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   615
                        return methodDoc;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   616
                    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   617
                }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   618
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   619
            return null;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   620
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   621
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   622
        private MethodDoc setterForField(MethodDoc[] methods,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   623
                                         MethodDoc propertyMethod) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   624
            final String propertyMethodName = propertyMethod.name();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   625
            final String fieldName =
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   626
                    propertyMethodName.substring(0,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   627
                            propertyMethodName.lastIndexOf("Property"));
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   628
            final String fieldNameUppercased =
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   629
                    "" + Character.toUpperCase(fieldName.charAt(0))
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   630
                                             + fieldName.substring(1);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   631
            final String setter = "set" + fieldNameUppercased;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   632
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   633
            for (MethodDoc methodDoc : methods) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   634
                if (setter.equals(methodDoc.name())) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   635
                    if (1 == methodDoc.parameters().length
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   636
                            && "void".equals(methodDoc.returnType().simpleTypeName())
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   637
                            && (methodDoc.isPublic() || methodDoc.isProtected())) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   638
                        return methodDoc;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   639
                    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   640
                }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   641
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   642
            return null;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   643
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   644
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   645
        private FieldDoc fieldForProperty(FieldDoc[] fields, MethodDoc property) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   646
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   647
            for (FieldDoc field : fields) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   648
                final String fieldName = field.name();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   649
                final String propertyName = fieldName + "Property";
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   650
                if (propertyName.equals(property.name())) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   651
                    return field;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   652
                }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   653
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   654
            return null;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   655
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   656
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   657
        // properties aren't named setA* or getA*
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   658
        private final Pattern pattern = Pattern.compile("[sg]et\\p{Upper}.*");
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   659
        private boolean isPropertyMethod(MethodDoc method) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   660
            if (!method.name().endsWith("Property")) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   661
                return false;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   662
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   663
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   664
            if (! memberIsVisible(method)) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   665
                return false;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   666
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   667
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   668
            if (pattern.matcher(method.name()).matches()) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   669
                return false;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   670
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   671
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   672
            return 0 == method.parameters().length
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   673
                    && !"void".equals(method.returnType().simpleTypeName());
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   674
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   675
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   676
        private void checkOnPropertiesTags(MethodDoc[] members) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   677
            for (MethodDoc methodDoc: members) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   678
                if (methodDoc.isIncluded()) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   679
                    for (Tag tag: methodDoc.tags()) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   680
                        String tagName = tag.name();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   681
                        if (tagName.equals("@propertySetter")
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   682
                                || tagName.equals("@propertyGetter")
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   683
                                || tagName.equals("@propertyDescription")) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   684
                            if (!isPropertyGetterOrSetter(members, methodDoc)) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   685
                                configuration.message.warning(tag.position(),
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   686
                                        "doclet.javafx_tag_misuse");
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   687
                            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   688
                            break;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   689
                        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   690
                    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   691
                }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   692
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   693
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   694
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   695
        private boolean isPropertyGetterOrSetter(MethodDoc[] members,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   696
                                                 MethodDoc methodDoc) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   697
            boolean found = false;
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 20237
diff changeset
   698
            String propertyName = Util.propertyNameFromMethodName(configuration, methodDoc.name());
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   699
            if (!propertyName.isEmpty()) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   700
                String propertyMethodName = propertyName + "Property";
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   701
                for (MethodDoc member: members) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   702
                    if (member.name().equals(propertyMethodName)) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   703
                        found = true;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   704
                        break;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   705
                    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   706
                }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   707
            }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   708
            return found;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   709
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   710
    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   711
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   712
    private class GetterSetter {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   713
        private final ProgramElementDoc getter;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   714
        private final ProgramElementDoc setter;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   715
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   716
        public GetterSetter(ProgramElementDoc getter, ProgramElementDoc setter) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   717
            this.getter = getter;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   718
            this.setter = setter;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   719
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   720
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   721
        public ProgramElementDoc getGetter() {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   722
            return getter;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   723
        }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   724
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   725
        public ProgramElementDoc getSetter() {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   726
            return setter;
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14260
diff changeset
   727
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   728
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   729
06bc494ca11e Initial load
duke
parents:
diff changeset
   730
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   731
     * Return true if this map has no visible members.
06bc494ca11e Initial load
duke
parents:
diff changeset
   732
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   733
     * @return true if this map has no visible members.
06bc494ca11e Initial load
duke
parents:
diff changeset
   734
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   735
    public boolean noVisibleMembers() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   736
        return noVisibleMembers;
06bc494ca11e Initial load
duke
parents:
diff changeset
   737
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   738
06bc494ca11e Initial load
duke
parents:
diff changeset
   739
    private ClassMember getClassMember(MethodDoc member) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   740
        for (Object key : memberNameMap.keySet()) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   741
            if (key instanceof String) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   742
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   743
            } else if (((ClassMember) key).isEqual(member)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   744
                return (ClassMember) key;
06bc494ca11e Initial load
duke
parents:
diff changeset
   745
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   746
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   747
        return new ClassMember(member);
06bc494ca11e Initial load
duke
parents:
diff changeset
   748
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   749
06bc494ca11e Initial load
duke
parents:
diff changeset
   750
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   751
     * Return the key to the member map for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
   752
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   753
    private Object getMemberKey(ProgramElementDoc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   754
        if (doc.isConstructor()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   755
            return doc.name() + ((ExecutableMemberDoc)doc).signature();
06bc494ca11e Initial load
duke
parents:
diff changeset
   756
        } else if (doc.isMethod()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   757
            return getClassMember((MethodDoc) doc);
06bc494ca11e Initial load
duke
parents:
diff changeset
   758
        } else if (doc.isField() || doc.isEnumConstant() || doc.isAnnotationTypeElement()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   759
            return doc.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
   760
        } else { // it's a class or interface
06bc494ca11e Initial load
duke
parents:
diff changeset
   761
            String classOrIntName = doc.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
   762
            //Strip off the containing class name because we only want the member name.
06bc494ca11e Initial load
duke
parents:
diff changeset
   763
            classOrIntName = classOrIntName.indexOf('.') != 0 ? classOrIntName.substring(classOrIntName.lastIndexOf('.'), classOrIntName.length()) : classOrIntName;
06bc494ca11e Initial load
duke
parents:
diff changeset
   764
            return "clint" + classOrIntName;
06bc494ca11e Initial load
duke
parents:
diff changeset
   765
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   766
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   767
}