langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
author bpatel
Thu, 08 Jan 2009 16:26:59 -0800
changeset 1787 1aa079321cd2
parent 10 06bc494ca11e
child 5520 86e4b9a9da40
permissions -rw-r--r--
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * Copyright 1997-2005 Sun Microsystems, Inc.  All Rights Reserved.
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
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
 * have any questions.
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.formats.html;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
 * Print method and constructor info.
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
    public AbstractExecutableMemberWriter(SubWriterHolderWriter writer,
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
                                     ClassDoc classdoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
        super(writer, classdoc);
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
    public AbstractExecutableMemberWriter(SubWriterHolderWriter writer) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
        super(writer);
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
     * Write the type parameters for the executable member.
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
     * @param member the member to write type parameters for.
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     * @return the display length required to write this information.
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
    protected int writeTypeParameters(ExecutableMemberDoc member) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
        LinkInfoImpl linkInfo = new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
            LinkInfoImpl.CONTEXT_MEMBER_TYPE_PARAMS, member, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
        String typeParameters = writer.getTypeParameterLinks(linkInfo);
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
        if (linkInfo.displayLength > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
            writer.print(typeParameters + " ");
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
            writer.displayLength += linkInfo.displayLength + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
        return linkInfo.displayLength;
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    protected void writeSignature(ExecutableMemberDoc member) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        writer.displayLength = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
        writer.pre();
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
        writer.writeAnnotationInfo(member);
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
        printModifiers(member);
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
        writeTypeParameters(member);
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
        if (configuration().linksource &&
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
            member.position().line() != classdoc.position().line()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
            writer.printSrcLink(member, member.name());
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
        } else {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    74
            strong(member.name());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
        writeParameters(member);
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
        writeExceptions(member);
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
        writer.preEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    protected void writeDeprecatedLink(ProgramElementDoc member) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
        ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
        writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc) emd,
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
            emd.qualifiedName() + emd.flatSignature(), false);
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
        ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
        String name = emd.name();
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    90
        writer.strong();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
        writer.printDocLink(context, cd, (MemberDoc) emd,
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
            name, false);
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    93
        writer.strongEnd();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        writer.displayLength = name.length();
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
        writeParameters(emd, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    protected void writeInheritedSummaryLink(ClassDoc cd,
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
            ProgramElementDoc member) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
        writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc) member,
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
            member.name(), false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    protected void writeParam(ExecutableMemberDoc member, Parameter param,
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
        boolean isVarArg) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
        if (param.type() != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
            writer.printLink(new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
                LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM, param.type(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
                isVarArg));
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
        if(param.name().length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
            writer.space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
            writer.print(param.name());
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    protected void writeParameters(ExecutableMemberDoc member) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        writeParameters(member, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    protected void writeParameters(ExecutableMemberDoc member,
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
            boolean includeAnnotations) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
        print('(');
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        Parameter[] params = member.parameters();
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        String indent = makeSpace(writer.displayLength);
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        if (configuration().linksource) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
            //add spaces to offset indentation changes caused by link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
            indent+= makeSpace(member.name().length());
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
        int paramstart;
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
        for (paramstart = 0; paramstart < params.length; paramstart++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
            Parameter param = params[paramstart];
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
            if (!param.name().startsWith("this$")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
                if (includeAnnotations) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
                        boolean foundAnnotations =
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
                                writer.writeAnnotationInfo(indent.length(), member, param);
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
                        if (foundAnnotations) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
                                writer.println();
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
                                writer.print(indent);
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
                writeParam(member, param,
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
                    (paramstart == params.length - 1) && member.isVarArgs());
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
                break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
        for (int i = paramstart + 1; i < params.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
            writer.print(',');
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
            writer.println();
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
            writer.print(indent);
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
            if (includeAnnotations) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
                boolean foundAnnotations =
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
                    writer.writeAnnotationInfo(indent.length(), member, params[i]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
                if (foundAnnotations) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
                    writer.println();
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
                    writer.print(indent);
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            writeParam(member, params[i], (i == params.length - 1) && member.isVarArgs());
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
        writer.print(')');
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    protected void writeExceptions(ExecutableMemberDoc member) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        Type[] exceptions = member.thrownExceptionTypes();
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
        if(exceptions.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
            LinkInfoImpl memberTypeParam = new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
                LinkInfoImpl.CONTEXT_MEMBER, member, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
            int retlen = getReturnTypeLength(member);
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
            writer.getTypeParameterLinks(memberTypeParam);
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
            retlen += memberTypeParam.displayLength == 0 ?
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
                0 : memberTypeParam.displayLength + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
            String indent = makeSpace(modifierString(member).length() +
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
                member.name().length() + retlen - 4);
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
            writer.println();
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
            writer.print(indent);
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
            writer.print("throws ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
            indent += "       ";
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
            writer.printLink(new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
                LinkInfoImpl.CONTEXT_MEMBER, exceptions[0]));
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
            for(int i = 1; i < exceptions.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
                writer.println(",");
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
                writer.print(indent);
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
                writer.printLink(new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
                    LinkInfoImpl.CONTEXT_MEMBER, exceptions[i]));
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
    protected int getReturnTypeLength(ExecutableMemberDoc member) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
        if (member instanceof MethodDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
            MethodDoc method = (MethodDoc)member;
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
            Type rettype = method.returnType();
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
            if (rettype.isPrimitive()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
                return rettype.typeName().length() +
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
                       rettype.dimension().length();
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
                LinkInfoImpl linkInfo = new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
                    LinkInfoImpl.CONTEXT_MEMBER, rettype);
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
                writer.getLink(linkInfo);
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
                return linkInfo.displayLength;
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        } else {   // it's a constructordoc
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
            return -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
    protected ClassDoc implementsMethodInIntfac(MethodDoc method,
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
                                                ClassDoc[] intfacs) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
        for (int i = 0; i < intfacs.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
            MethodDoc[] methods = intfacs[i].methods();
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
            if (methods.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
                for (int j = 0; j < methods.length; j++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
                    if (methods[j].name().equals(method.name()) &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
                          methods[j].signature().equals(method.signature())) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
                        return intfacs[i];
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     * For backward compatibility, include an anchor using the erasures of the
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
     * parameters.  NOTE:  We won't need this method anymore after we fix
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
     * see tags so that they use the type instead of the erasure.
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     * @param emd the ExecutableMemberDoc to anchor to.
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
     * @return the 1.4.x style anchor for the ExecutableMemberDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
    protected String getErasureAnchor(ExecutableMemberDoc emd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
        StringBuffer buf = new StringBuffer(emd.name() + "(");
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
        Parameter[] params = emd.parameters();
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
        boolean foundTypeVariable = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
        for (int i = 0; i < params.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
            if (i > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
                buf.append(",");
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
            Type t = params[i].type();
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
            foundTypeVariable = foundTypeVariable || t.asTypeVariable() != null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
            buf.append(t.isPrimitive() ?
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
                t.typeName() : t.asClassDoc().qualifiedName());
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
            buf.append(t.dimension());
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
        buf.append(")");
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
        return foundTypeVariable ? buf.toString() : null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
}