langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
author tbell
Mon, 09 Mar 2009 23:53:41 -0700
changeset 2223 95e3c21b2919
parent 2212 1d3dc0e0ba0c
parent 2216 b124d5c924eb
child 5520 86e4b9a9da40
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
2212
1d3dc0e0ba0c 6814575: Update copyright year
xdono
parents: 2086
diff changeset
     2
 * Copyright 2003-2009 Sun Microsystems, Inc.  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
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.internal.toolkit.builders;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.io.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import java.lang.reflect.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import java.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    32
import com.sun.javadoc.*;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    33
import com.sun.tools.doclets.internal.toolkit.util.*;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    34
import com.sun.tools.doclets.internal.toolkit.*;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    35
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * Builds the serialized form.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * This code is not part of an API.
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * It is implementation that is subject to change.
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * Do not use it as an API
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * @author Jamie Ho
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    44
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
public class SerializedFormBuilder extends AbstractBuilder {
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
     * The root element of the serialized form XML is {@value}.
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
    public static final String NAME = "SerializedForm";
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
     * The writer for this builder.
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    private SerializedFormWriter writer;
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     * The writer for serializable fields.
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    private SerializedFormWriter.SerialFieldWriter fieldWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     * The writer for serializable method documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    private SerializedFormWriter.SerialMethodWriter methodWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     * The header for the serial version UID.  Save the string
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     * here instead of the properties file because we do not want
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     * this string to be localized.
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    private static final String SERIAL_VERSION_UID_HEADER = "serialVersionUID:";
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     * The current package being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    private PackageDoc currentPackage;
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     * The current class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    private ClassDoc currentClass;
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     * The current member being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    protected MemberDoc currentMember;
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    private SerializedFormBuilder(Configuration configuration) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
        super(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     * Construct a new SerializedFormBuilder.
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * @param configuration the current configuration of the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    public static SerializedFormBuilder getInstance(Configuration configuration) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
        SerializedFormBuilder builder = new SerializedFormBuilder(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
        return builder;
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     * Build the serialized form.
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    public void build() throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
        if (! serialClassFoundToDocument(configuration.root.classes())) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
            //Nothing to document.
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
            writer = configuration.getWriterFactory().getSerializedFormWriter();
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
            if (writer == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
                //Doclet does not support this output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
                return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        } catch (Exception e) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
            throw new DocletAbortException();
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        build(LayoutParser.getInstance(configuration).parseXML(NAME));
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
        writer.close();
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    public String getName() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        return NAME;
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * Build the serialized form.
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 10
diff changeset
   135
    public void buildSerializedForm(List<?> elements) throws Exception {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
        build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        writer.close();
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 10
diff changeset
   143
    public void invokeMethod(String methodName, Class<?>[] paramClasses,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
            Object[] params)
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
        if (DEBUG) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
            configuration.root.printError("DEBUG: " + this.getClass().getName()
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
                + "." + methodName);
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
        Method method = this.getClass().getMethod(methodName, paramClasses);
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
        method.invoke(this, params);
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     * Build the header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    public void buildHeader() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        writer.writeHeader(configuration.getText("doclet.Serialized_Form"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     * Build the contents.
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 10
diff changeset
   164
    public void buildSerializedFormSummaries(List<?> elements) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        PackageDoc[] packages = configuration.packages;
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        for (int i = 0; i < packages.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
            currentPackage = packages[i];
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
            build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     * Build the package serialized for for the current package being processed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 10
diff changeset
   175
    public void buildPackageSerializedForm(List<?> elements) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
        String foo = currentPackage.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
        ClassDoc[] classes = currentPackage.allClasses(false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
        if (classes == null || classes.length == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
        if (!serialInclude(currentPackage)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
        if (!serialClassFoundToDocument(classes)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
        build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
    public void buildPackageHeader() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
        writer.writePackageHeader(Util.getPackageName(currentPackage));
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 10
diff changeset
   194
    public void buildClassSerializedForm(List<?> elements) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
        ClassDoc[] classes = currentPackage.allClasses(false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        Arrays.sort(classes);
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
        for (int j = 0; j < classes.length; j++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
            currentClass = classes[j];
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
            fieldWriter = writer.getSerialFieldWriter(currentClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
            methodWriter = writer.getSerialMethodWriter(currentClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
            if(currentClass.isClass() && currentClass.isSerializable()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
                if(!serialClassInclude(currentClass)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
                    continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
                build(elements);
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
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
    public void buildClassHeader() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
        writer.writeClassHeader(currentClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     * Build the serial UID information for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
    public void buildSerialUIDInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
        FieldDoc[] fields = currentClass.fields(false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
        for (int i = 0; i < fields.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
            if (fields[i].name().equals("serialVersionUID") &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
                fields[i].constantValueExpression() != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
                writer.writeSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
                    fields[i].constantValueExpression());
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
                return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     * Build the footer.
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
    public void buildFooter() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        writer.writeFooter();
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
     * Return true if the given Doc should be included
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
     * in the serialized form.
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
     * @param doc the Doc object to check for serializability.
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
    public static boolean serialInclude(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
        if (doc == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
        return doc.isClass() ?
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
            serialClassInclude((ClassDoc)doc) :
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
            serialDocInclude(doc);
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
     * Return true if the given ClassDoc should be included
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
     * in the serialized form.
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
     * @param cd the ClassDoc object to check for serializability.
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
    private static boolean serialClassInclude(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
        if (cd.isEnum()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
            cd.superclassType();
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
        } catch (NullPointerException e) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
            //Workaround for null pointer bug in ClassDoc.superclassType().
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
        if (cd.isSerializable()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
            if (cd.tags("serial").length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
                return serialDocInclude(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
            } else if (cd.isPublic() || cd.isProtected()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
                return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
                return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
        return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
     * Return true if the given Doc should be included
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
     * in the serialized form.
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
     * @param doc the Doc object to check for serializability.
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
    private static boolean serialDocInclude(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
        if (doc.isEnum()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
        Tag[] serial = doc.tags("serial");
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
        if (serial.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
            String serialtext = serial[0].text().toLowerCase();
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
            if (serialtext.indexOf("exclude") >= 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
                return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
            } else if (serialtext.indexOf("include") >= 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
                return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
     * Return true if any of the given classes have a @serialinclude tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
     * @param classes the classes to check.
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
     * @return true if any of the given classes have a @serialinclude tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
    private boolean serialClassFoundToDocument(ClassDoc[] classes) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
        for (int i = 0; i < classes.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
            if (serialClassInclude(classes[i])) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
                return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
        return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
     * Build the method header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
    public void buildMethodHeader() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
        if (currentClass.serializationMethods().length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
            methodWriter.writeHeader(
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
                configuration.getText("doclet.Serialized_Form_methods"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
            if (currentClass.isSerializable() && !currentClass.isExternalizable()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
                if (currentClass.serializationMethods().length == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
                    methodWriter.writeNoCustomizationMsg(
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
                        configuration.getText(
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
                            "doclet.Serializable_no_customization"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
        }
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
     * Build the method sub header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
    public void buildMethodSubHeader()  {
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
        methodWriter.writeMemberHeader((MethodDoc) currentMember);
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
     * Build the deprecated method description.
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
    public void buildDeprecatedMethodInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
        methodWriter.writeDeprecatedMemberInfo((MethodDoc) currentMember);
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
     * Build method tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
    public void buildMethodDescription() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
        methodWriter.writeMemberDescription((MethodDoc) currentMember);
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
     * Build the method tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
    public void buildMethodTags() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
        methodWriter.writeMemberTags((MethodDoc) currentMember);
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
        MethodDoc method = (MethodDoc)currentMember;
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
        if (method.name().compareTo("writeExternal") == 0
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
            && method.tags("serialData").length == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
            if (configuration.serialwarn) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
                configuration.getDocletSpecificMsg().warning(
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
                    currentMember.position(), "doclet.MissingSerialDataTag",
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
                    method.containingClass().qualifiedName(), method.name());
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
     * build the information for the method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 10
diff changeset
   373
    public void buildMethodInfo(List<?> elements)  {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
        if(configuration.nocomment){
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
        build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
     * Build the method footer.
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
    public void buildMethodFooter() {
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   384
        methodWriter.writeMemberFooter();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
     * Build the field header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
    public void buildFieldHeader() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
        if (currentClass.serializableFields().length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
            buildFieldSerializationOverview(currentClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
            fieldWriter.writeHeader(configuration.getText(
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
                "doclet.Serialized_Form_fields"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
     * If possible, build the serialization overview for the given
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
     * class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
     * @param classDoc the class to print the overview for.
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
    public void buildFieldSerializationOverview(ClassDoc classDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
        if (classDoc.definesSerializableFields()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
            FieldDoc serialPersistentField =
1870
57a1138dffc8 6795903: fix latent build warnings in langtools repository
jjg
parents: 1789
diff changeset
   407
                Util.asList(classDoc.serializableFields()).get(0);
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   408
            // Check to see if there are inline comments, tags or deprecation
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   409
            // information to be printed.
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   410
            if (fieldWriter.shouldPrintOverview(serialPersistentField)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
                fieldWriter.writeHeader(
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   412
                        configuration.getText("doclet.Serialized_Form_class"));
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   413
                fieldWriter.writeMemberDeprecatedInfo(serialPersistentField);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
                if (!configuration.nocomment) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
                    fieldWriter.writeMemberDescription(serialPersistentField);
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
                    fieldWriter.writeMemberTags(serialPersistentField);
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
                }
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   418
                // Footer required to close the definition list tag
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   419
                // for serialization overview.
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   420
                fieldWriter.writeFooter(
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   421
                        configuration.getText("doclet.Serialized_Form_class"));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   422
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   423
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
     * Build the field sub header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
    public void buildFieldSubHeader() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
        if (! currentClass.definesSerializableFields() ){
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
            FieldDoc field = (FieldDoc) currentMember;
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
            fieldWriter.writeMemberHeader(field.type().asClassDoc(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
                field.type().typeName(), field.type().dimension(), field.name());
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
    /**
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   438
     * Build the field deprecation information.
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   439
     */
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   440
    public void buildFieldDeprecationInfo() {
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   441
        if (!currentClass.definesSerializableFields()) {
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   442
            FieldDoc field = (FieldDoc)currentMember;
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   443
            fieldWriter.writeMemberDeprecatedInfo(field);
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   444
        }
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   445
    }
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   446
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1870
diff changeset
   447
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
     * Build the field information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
    public void buildFieldInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
        if(configuration.nocomment){
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
        FieldDoc field = (FieldDoc)currentMember;
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
        ClassDoc cd = field.containingClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
        if (cd.definesSerializableFields()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
            // Process Serializable Fields specified as array of
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
            // ObjectStreamFields. Print a member for each serialField tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
            // (There should be one serialField tag per ObjectStreamField
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
            // element.)
06bc494ca11e Initial load
duke
parents:
diff changeset
   461
            SerialFieldTag[] tags = field.serialFieldTags();
06bc494ca11e Initial load
duke
parents:
diff changeset
   462
            Arrays.sort(tags);
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
            for (int i = 0; i < tags.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
                fieldWriter.writeMemberHeader(tags[i].fieldTypeDoc(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
                        tags[i].fieldType(), "", tags[i].fieldName());
06bc494ca11e Initial load
duke
parents:
diff changeset
   466
                fieldWriter.writeMemberDescription(tags[i]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
06bc494ca11e Initial load
duke
parents:
diff changeset
   468
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
            // Process default Serializable field.
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
            if ((field.tags("serial").length == 0) && ! field.isSynthetic()
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
                && configuration.serialwarn) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
                configuration.message.warning(field.position(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
                        "doclet.MissingSerialTag", cd.qualifiedName(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
                        field.name());
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
            fieldWriter.writeMemberDescription(field);
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
            fieldWriter.writeMemberTags(field);
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
    /**
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   484
     * Build the field sub footer.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
     */
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   486
    public void buildFieldSubFooter() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
        if (! currentClass.definesSerializableFields()) {
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   488
            fieldWriter.writeMemberFooter();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   489
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
06bc494ca11e Initial load
duke
parents:
diff changeset
   492
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   493
     * Build the summaries for the methods that belong to the given
06bc494ca11e Initial load
duke
parents:
diff changeset
   494
     * class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 10
diff changeset
   496
    public void buildSerializableMethods(List<?> elements) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   497
        MemberDoc[] members = currentClass.serializationMethods();
06bc494ca11e Initial load
duke
parents:
diff changeset
   498
        if (members.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   499
            for (int i = 0; i < members.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   500
                currentMember = members[i];
06bc494ca11e Initial load
duke
parents:
diff changeset
   501
                build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   502
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   503
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   504
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   505
06bc494ca11e Initial load
duke
parents:
diff changeset
   506
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   507
     * Build the summaries for the fields that belong to the given
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
     * class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   509
     */
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 10
diff changeset
   510
    public void buildSerializableFields(List<?> elements) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   511
        MemberDoc[] members = currentClass.serializableFields();
06bc494ca11e Initial load
duke
parents:
diff changeset
   512
        if (members.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   513
            for (int i = 0; i < members.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   514
                currentMember = members[i];
06bc494ca11e Initial load
duke
parents:
diff changeset
   515
                build(elements);
06bc494ca11e Initial load
duke
parents:
diff changeset
   516
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   517
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   519
}