1 /* |
1 /* |
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 4341304 4485668 4966728 8032066 |
26 * @bug 4341304 4485668 4966728 8032066 8071982 |
27 * @summary Test that methods readResolve and writeReplace show |
27 * @summary Test that methods readResolve and writeReplace show |
28 * up in serialized-form.html the same way that readObject and writeObject do. |
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 |
29 * If the doclet includes readResolve and writeReplace in the serialized-form |
30 * documentation that same way the it includes readObject and writeObject, the |
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 |
31 * test passes. This also tests that throws tag information is correctly shown |
39 * @run main TestSerializedForm |
39 * @run main TestSerializedForm |
40 */ |
40 */ |
41 |
41 |
42 import java.io.*; |
42 import java.io.*; |
43 |
43 |
44 public class TestSerializedForm extends JavadocTester implements Serializable { |
44 public class TestSerializedForm extends JavadocTester { |
45 public static void main(String... args) throws Exception { |
45 public static void main(String... args) throws Exception { |
46 TestSerializedForm tester = new TestSerializedForm(); |
46 TestSerializedForm tester = new TestSerializedForm(); |
47 tester.runTests(); |
47 tester.runTests(); |
48 // tester.run(ARGS, TEST, NEGATED_TEST); |
48 // tester.run(ARGS, TEST, NEGATED_TEST); |
49 // tester.run(ARGS_PRIVATE, TEST_PRIVATE, NEGATED_TEST_PRIVATE); |
49 // tester.run(ARGS_PRIVATE, TEST_PRIVATE, NEGATED_TEST_PRIVATE); |
50 // tester.printSummary(); |
50 // tester.printSummary(); |
51 } |
51 } |
52 |
52 |
53 @Test |
53 // @ignore 8146022 |
|
54 // @Test |
54 void testDefault() { |
55 void testDefault() { |
55 javadoc("-d", "out-default", |
56 javadoc("-d", "out-default", "-serialwarn", "-Xdoclint:none", |
56 "-sourcepath", testSrc, |
57 "-sourcepath", testSrc, |
57 testSrc("TestSerializedForm.java"), "pkg1"); |
58 testSrc("SerializedForm.java"), testSrc("ExternalizedForm.java"), "pkg1"); |
58 checkExit(Exit.OK); |
59 checkExit(Exit.OK); |
59 |
60 |
60 checkOutput("serialized-form.html", true, |
61 checkOutput("serialized-form.html", true, |
61 "protected java.lang.Object readResolve()", |
62 "protected java.lang.Object readResolve()", |
62 "protected java.lang.Object writeReplace()", |
63 "protected java.lang.Object writeReplace()", |
63 "protected java.lang.Object readObjectNoData()", |
64 "protected java.lang.Object readObjectNoData()", |
64 "See Also", |
65 "<h3>Serialization Overview</h3>\n<ul class=\"blockList\">\n" |
|
66 + "<li class=\"blockListLast\">\n<div class=\"block\">" |
|
67 + "<span class=\"deprecatedLabel\">Deprecated.</span> </div>\n" |
|
68 + "<dl>\n<dt><span class=\"seeLabel\">See Also:</span></dt>\n" |
|
69 + "<dd><code>TestSerializedForm</code></dd>\n</dl>", |
65 "<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass " |
70 "<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass " |
66 + "extends java.lang.Object implements Serializable</h3>", |
71 + "extends java.lang.Object implements Serializable</h3>", |
67 "<h3>Class pkg1.PrivateIncludeInnerClass.PriInnerClass extends " |
72 "<h3>Class pkg1.PrivateIncludeInnerClass.PriInnerClass extends " |
68 + "java.lang.Object implements Serializable</h3>", |
73 + "java.lang.Object implements Serializable</h3>", |
69 "<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends " |
74 "<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends " |
84 @Test |
89 @Test |
85 void testPrivate() { |
90 void testPrivate() { |
86 javadoc("-private", |
91 javadoc("-private", |
87 "-d", "out-private", |
92 "-d", "out-private", |
88 "-sourcepath", testSrc, |
93 "-sourcepath", testSrc, |
89 testSrc("TestSerializedForm.java"), "pkg1"); |
94 testSrc("SerializedForm.java"), testSrc("ExternalizedForm.java"), "pkg1"); |
90 checkExit(Exit.OK); |
95 checkExit(Exit.OK); |
91 |
96 |
92 checkOutput("serialized-form.html", true, |
97 checkOutput("serialized-form.html", true, |
93 "<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" " |
98 "<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" " |
94 + "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> " |
99 + "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> " |
107 + "java.lang.Object implements Serializable</h3>", |
112 + "java.lang.Object implements Serializable</h3>", |
108 "<h3>Class <a href=\"pkg1/PublicExcludeInnerClass.PubInnerClass.html\" " |
113 "<h3>Class <a href=\"pkg1/PublicExcludeInnerClass.PubInnerClass.html\" " |
109 + "title=\"class in pkg1\">pkg1.PublicExcludeInnerClass.PubInnerClass</a> " |
114 + "title=\"class in pkg1\">pkg1.PublicExcludeInnerClass.PubInnerClass</a> " |
110 + "extends java.lang.Object implements Serializable</h3>"); |
115 + "extends java.lang.Object implements Serializable</h3>"); |
111 } |
116 } |
112 |
|
113 /** |
|
114 * @serial |
|
115 * @see TestSerializedForm |
|
116 */ |
|
117 public final int SERIALIZABLE_CONSTANT = 1; |
|
118 |
|
119 /** |
|
120 * The entry point of the test. |
|
121 * @param args the array of command line arguments. |
|
122 */ |
|
123 |
|
124 /** |
|
125 * @param s ObjectInputStream. |
|
126 * @throws IOException when there is an I/O error. |
|
127 * @serial |
|
128 */ |
|
129 private void readObject(ObjectInputStream s) throws IOException {} |
|
130 |
|
131 /** |
|
132 * @param s ObjectOutputStream. |
|
133 * @throws IOException when there is an I/O error. |
|
134 * @serial |
|
135 */ |
|
136 private void writeObject(ObjectOutputStream s) throws IOException {} |
|
137 |
|
138 /** |
|
139 * @throws IOException when there is an I/O error. |
|
140 * @serialData This is a serial data comment. |
|
141 * @return an object. |
|
142 */ |
|
143 protected Object readResolve() throws IOException {return null;} |
|
144 |
|
145 /** |
|
146 * @throws IOException when there is an I/O error. |
|
147 * @serialData This is a serial data comment. |
|
148 * @return an object. |
|
149 */ |
|
150 protected Object writeReplace() throws IOException {return null;} |
|
151 |
|
152 /** |
|
153 * @throws IOException when there is an I/O error. |
|
154 * @serialData This is a serial data comment. |
|
155 * @return an object. |
|
156 */ |
|
157 protected Object readObjectNoData() throws IOException { |
|
158 return null; |
|
159 } |
|
160 |
|
161 } |
117 } |