10
|
1 |
/*
|
|
2 |
* Copyright 2001-2003 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
import java.lang.*;
|
|
25 |
import java.io.*;
|
|
26 |
|
|
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 |
*/
|
|
43 |
|
|
44 |
public class TestSerializedForm extends JavadocTester implements Serializable {
|
|
45 |
|
|
46 |
private static final String BUG_ID = "4341304-4485668-4966728";
|
|
47 |
|
|
48 |
private static final String[][] TEST = {
|
|
49 |
{BUG_ID + FS + "serialized-form.html",
|
|
50 |
"protected java.lang.Object <B>readResolve</B>()"},
|
|
51 |
{BUG_ID + FS + "serialized-form.html",
|
|
52 |
"protected java.lang.Object <B>writeReplace</B>()"},
|
|
53 |
{BUG_ID + FS + "serialized-form.html",
|
|
54 |
"protected java.lang.Object <B>readObjectNoData</B>()"},
|
|
55 |
{BUG_ID + FS + "serialized-form.html",
|
|
56 |
"See Also"},
|
|
57 |
};
|
|
58 |
|
|
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 |
};
|
|
64 |
|
|
65 |
/**
|
|
66 |
* @serial
|
|
67 |
* @see TestSerializedForm
|
|
68 |
*/
|
|
69 |
public final int SERIALIZABLE_CONSTANT = 1;
|
|
70 |
|
|
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 |
}
|
|
80 |
|
|
81 |
/**
|
|
82 |
* {@inheritDoc}
|
|
83 |
*/
|
|
84 |
public String getBugId() {
|
|
85 |
return BUG_ID;
|
|
86 |
}
|
|
87 |
|
|
88 |
/**
|
|
89 |
* {@inheritDoc}
|
|
90 |
*/
|
|
91 |
public String getBugName() {
|
|
92 |
return getClass().getName();
|
|
93 |
}
|
|
94 |
|
|
95 |
/**
|
|
96 |
* @throws IOException when there is an I/O error.
|
|
97 |
* @serial
|
|
98 |
*/
|
|
99 |
private void readObject(ObjectInputStream s) {}
|
|
100 |
|
|
101 |
/**
|
|
102 |
* @throws IOException when there is an I/O error.
|
|
103 |
* @serial
|
|
104 |
*/
|
|
105 |
private void writeObject(ObjectOutputStream s) {}
|
|
106 |
|
|
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;}
|
|
112 |
|
|
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;}
|
|
118 |
|
|
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 |
}
|
|
126 |
|
|
127 |
}
|