Wed, 27 Apr 2016 01:34:52 +0800
Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | /* |
aoqi@0 | 27 | * @test |
aoqi@0 | 28 | * @bug 6802694 8025633 8026567 |
aoqi@0 | 29 | * @summary This test verifies deprecation info in serialized-form.html. |
aoqi@0 | 30 | * @author Bhavesh Patel |
aoqi@0 | 31 | * @library ../lib/ |
aoqi@0 | 32 | * @build JavadocTester |
aoqi@0 | 33 | * @build TestSerializedFormDeprecationInfo |
aoqi@0 | 34 | * @run main TestSerializedFormDeprecationInfo |
aoqi@0 | 35 | */ |
aoqi@0 | 36 | |
aoqi@0 | 37 | public class TestSerializedFormDeprecationInfo extends JavadocTester { |
aoqi@0 | 38 | |
aoqi@0 | 39 | private static final String BUG_ID = "6802694"; |
aoqi@0 | 40 | |
aoqi@0 | 41 | // Test for normal run of javadoc. The serialized-form.html should |
aoqi@0 | 42 | // display the inline comments, tags and deprecation information if any. |
aoqi@0 | 43 | private static final String[][] TEST_CMNT_DEPR = { |
aoqi@0 | 44 | {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + |
aoqi@0 | 45 | "<dt><span class=\"throwsLabel\">Throws:</span></dt>" + NL + "<dd><code>" + |
aoqi@0 | 46 | "java.io.IOException</code></dd>"+ NL + "<dt><span class=\"seeLabel\">See Also:</span>" + |
aoqi@0 | 47 | "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + |
aoqi@0 | 48 | "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, |
aoqi@0 | 49 | {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" + |
aoqi@0 | 50 | " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL + |
aoqi@0 | 51 | " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + |
aoqi@0 | 52 | "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + |
aoqi@0 | 53 | "<div class=\"block\">This field indicates whether the C1 " + |
aoqi@0 | 54 | "is undecorated.</div>" + NL + " " + NL + |
aoqi@0 | 55 | "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL + |
aoqi@0 | 56 | "<dd>1.4</dd>" + NL + "<dt><span class=\"seeLabel\">See Also:</span>" + |
aoqi@0 | 57 | "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + |
aoqi@0 | 58 | "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, |
aoqi@0 | 59 | {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" + |
aoqi@0 | 60 | " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL + |
aoqi@0 | 61 | " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + |
aoqi@0 | 62 | "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + |
aoqi@0 | 63 | "<div class=\"block\">Reads the object stream.</div>" + NL + |
aoqi@0 | 64 | "<dl>" + NL + "<dt><span class=\"throwsLabel\">Throws:</span></dt>" + NL + "<dd><code><code>" + |
aoqi@0 | 65 | "IOException</code></code></dd>" + NL + |
aoqi@0 | 66 | "<dd><code>java.io.IOException</code></dd>" + NL + "</dl>"}, |
aoqi@0 | 67 | {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" + |
aoqi@0 | 68 | " </div>" + NL + "<div class=\"block\">" + |
aoqi@0 | 69 | "The name for this class.</div>"}}; |
aoqi@0 | 70 | |
aoqi@0 | 71 | // Test with -nocomment option. The serialized-form.html should |
aoqi@0 | 72 | // not display the inline comments and tags but should display deprecation |
aoqi@0 | 73 | // information if any. |
aoqi@0 | 74 | private static final String[][] TEST_NOCMNT = { |
aoqi@0 | 75 | {BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL + |
aoqi@0 | 76 | "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">" + |
aoqi@0 | 77 | "As of JDK version 1.5, replaced by" + NL + |
aoqi@0 | 78 | " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" + |
aoqi@0 | 79 | "setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}, |
aoqi@0 | 80 | {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">" + |
aoqi@0 | 81 | "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version" + |
aoqi@0 | 82 | " 1.5, replaced by" + NL + |
aoqi@0 | 83 | " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + |
aoqi@0 | 84 | "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}}; |
aoqi@0 | 85 | |
aoqi@0 | 86 | // Test with -nodeprecated option. The serialized-form.html should |
aoqi@0 | 87 | // ignore the -nodeprecated tag and display the deprecation info. This |
aoqi@0 | 88 | // test is similar to the normal run of javadoc in which inline comment, tags |
aoqi@0 | 89 | // and deprecation information will be displayed. |
aoqi@0 | 90 | private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR; |
aoqi@0 | 91 | |
aoqi@0 | 92 | // Test with -nodeprecated and -nocomment options. The serialized-form.html should |
aoqi@0 | 93 | // ignore the -nodeprecated tag and display the deprecation info but should not |
aoqi@0 | 94 | // display the inline comments and tags. This test is similar to the test with |
aoqi@0 | 95 | // -nocomment option. |
aoqi@0 | 96 | private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT; |
aoqi@0 | 97 | |
aoqi@0 | 98 | private static final String[] ARGS1 = |
aoqi@0 | 99 | new String[] { |
aoqi@0 | 100 | "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"}; |
aoqi@0 | 101 | |
aoqi@0 | 102 | private static final String[] ARGS2 = |
aoqi@0 | 103 | new String[] { |
aoqi@0 | 104 | "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"}; |
aoqi@0 | 105 | |
aoqi@0 | 106 | private static final String[] ARGS3 = |
aoqi@0 | 107 | new String[] { |
aoqi@0 | 108 | "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"}; |
aoqi@0 | 109 | |
aoqi@0 | 110 | private static final String[] ARGS4 = |
aoqi@0 | 111 | new String[] { |
aoqi@0 | 112 | "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"}; |
aoqi@0 | 113 | |
aoqi@0 | 114 | /** |
aoqi@0 | 115 | * The entry point of the test. |
aoqi@0 | 116 | * @param args the array of command line arguments. |
aoqi@0 | 117 | */ |
aoqi@0 | 118 | public static void main(String[] args) { |
aoqi@0 | 119 | TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo(); |
aoqi@0 | 120 | tester.exactNewlineMatch = false; |
aoqi@0 | 121 | run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT); |
aoqi@0 | 122 | run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR); |
aoqi@0 | 123 | run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR); |
aoqi@0 | 124 | run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR); |
aoqi@0 | 125 | tester.printSummary(); |
aoqi@0 | 126 | } |
aoqi@0 | 127 | |
aoqi@0 | 128 | /** |
aoqi@0 | 129 | * {@inheritDoc} |
aoqi@0 | 130 | */ |
aoqi@0 | 131 | public String getBugId() { |
aoqi@0 | 132 | return BUG_ID; |
aoqi@0 | 133 | } |
aoqi@0 | 134 | |
aoqi@0 | 135 | /** |
aoqi@0 | 136 | * {@inheritDoc} |
aoqi@0 | 137 | */ |
aoqi@0 | 138 | public String getBugName() { |
aoqi@0 | 139 | return getClass().getName(); |
aoqi@0 | 140 | } |
aoqi@0 | 141 | } |