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