author | lana |
Mon, 11 Aug 2014 09:25:30 -0700 | |
changeset 25880 | e5967ea9bde2 |
parent 24399 | af1a0220d0fa |
child 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
10 | 1 |
/* |
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
2 |
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
* |
|
5520 | 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. |
|
10 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
26 |
* @bug 4341304 4485668 4966728 8032066 |
10 | 27 |
* @summary Test that methods readResolve and writeReplace show |
28 |
* up in serialized-form.html the same way that readObject and writeObject do. |
|
29 |
* If the doclet includes readResolve and writeReplace in the serialized-form |
|
30 |
* documentation that same way the it includes readObject and writeObject, the |
|
31 |
* test passes. This also tests that throws tag information is correctly shown |
|
32 |
* in the serialized form page. |
|
33 |
* Make sure see tags work in serialized form. |
|
34 |
* @author jamieh |
|
35 |
* @library ../lib/ |
|
36 |
* @build JavadocTester |
|
37 |
* @build TestSerializedForm |
|
38 |
* @run main TestSerializedForm |
|
39 |
*/ |
|
40 |
||
24072 | 41 |
import java.io.*; |
10 | 42 |
|
24072 | 43 |
public class TestSerializedForm extends JavadocTester implements Serializable { |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
44 |
public static void main(String... args) throws Exception { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
45 |
TestSerializedForm tester = new TestSerializedForm(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
46 |
tester.runTests(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
47 |
// tester.run(ARGS, TEST, NEGATED_TEST); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
48 |
// tester.run(ARGS_PRIVATE, TEST_PRIVATE, NEGATED_TEST_PRIVATE); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
49 |
// tester.printSummary(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
50 |
} |
10 | 51 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
52 |
@Test |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
53 |
void testDefault() { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
54 |
javadoc("-d", "out-default", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
55 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
56 |
testSrc("TestSerializedForm.java"), "pkg1"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
57 |
checkExit(Exit.OK); |
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
58 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
59 |
checkOutput("serialized-form.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
60 |
"protected java.lang.Object readResolve()", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
61 |
"protected java.lang.Object writeReplace()", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
62 |
"protected java.lang.Object readObjectNoData()", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
63 |
"See Also", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
64 |
"<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
65 |
+ "extends java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
66 |
"<h3>Class pkg1.PrivateIncludeInnerClass.PriInnerClass extends " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
67 |
+ "java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
68 |
"<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
69 |
+ "java.lang.Object implements Serializable</h3>"); |
10 | 70 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
71 |
checkOutput("serialized-form.html", false, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
72 |
"<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
73 |
+ "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
74 |
+ "extends java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
75 |
"<h3>Class <a href=\"pkg1/PrivateInnerClass.PriInnerClass.html\" title=\"class in pkg1\">" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
76 |
+ "pkg1.PrivateInnerClass.PriInnerClass</a> extends java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
77 |
"<h3>Class <a href=\"pkg1/ProtectedInnerClass.ProInnerClass.html\" title=\"class in pkg1\">" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
78 |
+ "pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
79 |
"<h3>Class pkg1.PublicExcludeInnerClass.PubInnerClass extends java.lang.Object implements " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
80 |
+ "Serializable</h3>"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
81 |
} |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
82 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
83 |
@Test |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
84 |
void testPrivate() { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
85 |
javadoc("-private", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
86 |
"-d", "out-private", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
87 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
88 |
testSrc("TestSerializedForm.java"), "pkg1"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
89 |
checkExit(Exit.OK); |
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
90 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
91 |
checkOutput("serialized-form.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
92 |
"<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
93 |
+ "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
94 |
+ "extends java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
95 |
"<h3>Class <a href=\"pkg1/PrivateIncludeInnerClass.PriInnerClass.html\" title=\"class in pkg1\">" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
96 |
+ "pkg1.PrivateIncludeInnerClass.PriInnerClass</a> extends java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
97 |
"<h3>Class <a href=\"pkg1/ProtectedInnerClass.ProInnerClass.html\" title=\"class in pkg1\">" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
98 |
+ "pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implements Serializable</h3>"); |
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
99 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
100 |
checkOutput("serialized-form.html", false, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
101 |
"<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
102 |
+ "extends java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
103 |
"<h3>Class pkg1.PrivateInnerClass.PriInnerClass extends " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
104 |
+ "java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
105 |
"<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
106 |
+ "java.lang.Object implements Serializable</h3>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
107 |
"<h3>Class <a href=\"pkg1/PublicExcludeInnerClass.PubInnerClass.html\" " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
108 |
+ "title=\"class in pkg1\">pkg1.PublicExcludeInnerClass.PubInnerClass</a> " |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
109 |
+ "extends java.lang.Object implements Serializable</h3>"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
110 |
} |
10 | 111 |
|
112 |
/** |
|
113 |
* @serial |
|
114 |
* @see TestSerializedForm |
|
115 |
*/ |
|
116 |
public final int SERIALIZABLE_CONSTANT = 1; |
|
117 |
||
118 |
/** |
|
119 |
* The entry point of the test. |
|
120 |
* @param args the array of command line arguments. |
|
121 |
*/ |
|
122 |
||
123 |
/** |
|
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
124 |
* @param s ObjectInputStream. |
10 | 125 |
* @throws IOException when there is an I/O error. |
126 |
* @serial |
|
127 |
*/ |
|
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
128 |
private void readObject(ObjectInputStream s) throws IOException {} |
10 | 129 |
|
130 |
/** |
|
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
131 |
* @param s ObjectOutputStream. |
10 | 132 |
* @throws IOException when there is an I/O error. |
133 |
* @serial |
|
134 |
*/ |
|
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
135 |
private void writeObject(ObjectOutputStream s) throws IOException {} |
10 | 136 |
|
137 |
/** |
|
138 |
* @throws IOException when there is an I/O error. |
|
139 |
* @serialData This is a serial data comment. |
|
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
140 |
* @return an object. |
10 | 141 |
*/ |
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
142 |
protected Object readResolve() throws IOException {return null;} |
10 | 143 |
|
144 |
/** |
|
145 |
* @throws IOException when there is an I/O error. |
|
146 |
* @serialData This is a serial data comment. |
|
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
147 |
* @return an object. |
10 | 148 |
*/ |
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
149 |
protected Object writeReplace() throws IOException {return null;} |
10 | 150 |
|
151 |
/** |
|
152 |
* @throws IOException when there is an I/O error. |
|
153 |
* @serialData This is a serial data comment. |
|
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
154 |
* @return an object. |
10 | 155 |
*/ |
23805
3ef77c1ebf0b
8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents:
7681
diff
changeset
|
156 |
protected Object readObjectNoData() throws IOException { |
10 | 157 |
return null; |
158 |
} |
|
159 |
||
160 |
} |