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
1 /*
2 * Copyright (c) 2003, 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.
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 *
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.
22 */
24 /*
25 * @test
26 * @bug 4764045
27 * @summary This test ensures that the value tag works in all
28 * use cases. The explainations for each test case are written below.
29 * @author jamieh
30 * @library ../lib/
31 * @build JavadocTester
32 * @build TestValueTag
33 * @run main TestValueTag
34 */
36 public class TestValueTag extends JavadocTester {
38 //Test information.
39 private static final String BUG_ID = "4764045";
41 //Javadoc arguments.
42 private static final String[] ARGS =
43 new String[] {
44 "-d", BUG_ID, "-sourcepath", SRC_DIR, "-tag",
45 "todo", "pkg1", "pkg2"
46 };
48 //Input for string search tests.
49 private static final String[][] TEST = {
50 //Base case: using @value on a constant.
51 {BUG_ID + FS + "pkg1" + FS + "Class1.html",
52 "Result: \"Test 1 passes\""},
53 //Retrieve value of constant in same class.
54 {BUG_ID + FS + "pkg1" + FS + "Class1.html",
55 "Result: <A HREF=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</A>"},
56 {BUG_ID + FS + "pkg1" + FS + "Class1.html",
57 "Result: <A HREF=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</A>"},
58 {BUG_ID + FS + "pkg1" + FS + "Class1.html",
59 "Result: <A HREF=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</A>"},
60 {BUG_ID + FS + "pkg1" + FS + "Class1.html",
61 "Result: <A HREF=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</A>"},
62 {BUG_ID + FS + "pkg1" + FS + "Class1.html",
63 "Result: <A HREF=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</A>"},
64 //Retrieve value of constant in different class.
65 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
66 "Result: <A HREF=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</A>"},
67 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
68 "Result: <A HREF=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</A>"},
69 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
70 "Result: <A HREF=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</A>"},
71 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
72 "Result: <A HREF=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</A>"},
73 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
74 "Result: <A HREF=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</A>"},
75 //Retrieve value of constant in different package
76 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
77 "Result: <A HREF=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</A>"},
78 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
79 "Result: <A HREF=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</A>"},
80 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
81 "Result: <A HREF=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</A>"},
82 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
83 "Result: <A HREF=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</A>"},
84 {BUG_ID + FS + "pkg1" + FS + "Class2.html",
85 "Result: <A HREF=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</A>"},
86 //Retrieve value of constant from a package page
87 {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
88 "Result: <A HREF=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</A>"},
89 //Test @value tag used with custom tag.
90 {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
91 "<DT><STRONG>Todo:</STRONG></DT>" + NL +
92 " <DD>the value of this constant is 55.</DD>"},
93 //Test @value warning printed when used with non-constant.
94 {WARNING_OUTPUT,"warning - @value tag (which references nonConstant) " +
95 "can only be used in constants."
96 },
97 //Test warning printed for bad reference.
98 {WARNING_OUTPUT,"warning - UnknownClass#unknownConstant (referenced by " +
99 "@value tag) is an unknown reference."
100 },
101 };
102 private static final String[][] NEGATED_TEST = NO_TEST;
104 /**
105 * The entry point of the test.
106 * @param args the array of command line arguments.
107 */
108 public static void main(String[] args) {
109 TestValueTag tester = new TestValueTag();
110 run(tester, ARGS, TEST, NEGATED_TEST);
111 tester.printSummary();
112 }
114 /**
115 * {@inheritDoc}
116 */
117 public String getBugId() {
118 return BUG_ID;
119 }
121 /**
122 * {@inheritDoc}
123 */
124 public String getBugName() {
125 return getClass().getName();
126 }
127 }