test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java

Tue, 28 Dec 2010 15:54:52 -0800

author
ohair
date
Tue, 28 Dec 2010 15:54:52 -0800
changeset 798
4868a36f6fd8
parent 766
90af8d87741f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

     1 /*
     2  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  */
    24 import java.lang.*;
    25 import java.io.*;
    27 /*
    28  * @test
    29  * @bug 4341304 4485668 4966728
    30  * @summary Test that methods readResolve and writeReplace show
    31  * up in serialized-form.html the same way that readObject and writeObject do.
    32  * If the doclet includes readResolve and writeReplace in the serialized-form
    33  * documentation that same way the it includes readObject and writeObject, the
    34  * test passes.  This also tests that throws tag information is correctly shown
    35  * in the serialized form page.
    36  * Make sure see tags work in serialized form.
    37  * @author jamieh
    38  * @library ../lib/
    39  * @build JavadocTester
    40  * @build TestSerializedForm
    41  * @run main TestSerializedForm
    42  */
    44 public class TestSerializedForm extends JavadocTester implements Serializable {
    46     private static final String BUG_ID = "4341304-4485668-4966728";
    48     private static final String[][] TEST = {
    49         {BUG_ID + FS + "serialized-form.html",
    50             "protected java.lang.Object readResolve()"},
    51         {BUG_ID + FS + "serialized-form.html",
    52             "protected java.lang.Object writeReplace()"},
    53         {BUG_ID + FS + "serialized-form.html",
    54             "protected java.lang.Object readObjectNoData()"},
    55         {BUG_ID + FS + "serialized-form.html",
    56             "See Also"},
    57     };
    59     private static final String[][] NEGATED_TEST = NO_TEST;
    60     private static final String[] ARGS = new String[] {
    61         "-d", BUG_ID, "-sourcepath", SRC_DIR,
    62         SRC_DIR + FS + "TestSerializedForm.java"
    63     };
    65     /**
    66      * @serial
    67      * @see TestSerializedForm
    68      */
    69     public final int SERIALIZABLE_CONSTANT = 1;
    71     /**
    72      * The entry point of the test.
    73      * @param args the array of command line arguments.
    74      */
    75     public static void main(String[] args) {
    76         TestSerializedForm tester = new TestSerializedForm();
    77         int actualExitCode = run(tester, ARGS, TEST, NEGATED_TEST);
    78         tester.printSummary();
    79     }
    81     /**
    82      * {@inheritDoc}
    83      */
    84     public String getBugId() {
    85         return BUG_ID;
    86     }
    88     /**
    89      * {@inheritDoc}
    90      */
    91     public String getBugName() {
    92         return getClass().getName();
    93     }
    95     /**
    96      * @throws IOException when there is an I/O error.
    97      * @serial
    98      */
    99     private void readObject(ObjectInputStream s) {}
   101     /**
   102      * @throws IOException when there is an I/O error.
   103      * @serial
   104      */
   105     private void writeObject(ObjectOutputStream s) {}
   107     /**
   108      * @throws IOException when there is an I/O error.
   109      * @serialData This is a serial data comment.
   110      */
   111     protected Object readResolve(){return null;}
   113     /**
   114      * @throws IOException when there is an I/O error.
   115      * @serialData This is a serial data comment.
   116      */
   117     protected Object writeReplace(){return null;}
   119     /**
   120      * @throws IOException when there is an I/O error.
   121      * @serialData This is a serial data comment.
   122      */
   123     protected Object readObjectNoData() {
   124         return null;
   125     }
   127 }

mercurial