test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java

Thu, 15 Jul 2010 16:31:02 +0100

author
mcimadamore
date
Thu, 15 Jul 2010 16:31:02 +0100
changeset 607
b49b0d72c071
parent 554
9d9f26857129
child 766
90af8d87741f
permissions
-rw-r--r--

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

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

mercurial