Mon, 31 Aug 2009 12:36:26 -0700
6877229: more javac tests fail on Windows
Reviewed-by: darcy
1 /*
2 * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 */
24 /*
25 * @test
26 * @bug 6746458
27 * @summary Verify correct separate compilation of classes with extended identifiers.
28 * @author jrose
29 * @ignore 6877225 test fails on Windows:
30 * QuotedIdent.java:81: error while writing QuotedIdent.*86: PATH\QuotedIdent$*86.class
31 * (The filename, directory name, or volume label syntax is incorrect)
32 *
33 * @library ..
34 * @run main quid.QuotedIdent2
35 */
36 /*
37 * Standalone testing:
38 * <code>
39 * $ cd $MY_REPO_DIR/langtools
40 * $ (cd make; make)
41 * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent.java
42 * $ ./dist/bootstrap/bin/javac -d dist -cp dist test/tools/javac/quid/QuotedIdent2.java
43 * $ java -version # should print 1.6 or later
44 * $ java -cp dist QuotedIdent2
45 * </code>
46 */
48 package quid;
50 import quid.QuotedIdent.*;
51 import quid.QuotedIdent.#"*86";
52 import static quid.QuotedIdent.#"MAKE-*86";
54 public class QuotedIdent2 {
55 static void check(int testid, String have, String expect)
56 throws RuntimeException {
57 QuotedIdent.check(testid, have, expect);
58 }
60 public static void main(String[] args) throws Exception {
61 String s;
63 s = #"int".valueOf(123).toString();
64 check(22, s, "123");
66 s = #"MAKE-*86"().#"555-1212"();
67 check(23, s, "[*86.555-1212]");
69 s = #"Yog-Shoggoth".#"(nameless ululation)";
70 check(25, s, "Tekeli-li!");
72 s = QuotedIdent.#"int".class.getName();
73 check(31, s, QuotedIdent.class.getName()+"$int");
75 Class x86 = Class.forName(QuotedIdent.class.getName()+"$*86");
76 if (x86 != #"*86".class)
77 check(32, "reflected "+x86, "static "+#"*86".class);
79 s = (String) x86.getDeclaredMethod("555-1212").invoke(QuotedIdent.#"MAKE-*86"());
80 check(31, s, "[*86.555-1212]");
82 System.out.println("OK");
83 }
84 }