Wed, 12 Aug 2009 10:34:13 -0700
6558476: com/sun/tools/javac/Main.compile don't release file handles on return
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 *
30 * @library ..
31 * @run main quid.QuotedIdent2
32 */
33 /*
34 * Standalone testing:
35 * <code>
36 * $ cd $MY_REPO_DIR/langtools
37 * $ (cd make; make)
38 * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent.java
39 * $ ./dist/bootstrap/bin/javac -d dist -cp dist test/tools/javac/quid/QuotedIdent2.java
40 * $ java -version # should print 1.6 or later
41 * $ java -cp dist QuotedIdent2
42 * </code>
43 */
45 package quid;
47 import quid.QuotedIdent.*;
48 import quid.QuotedIdent.#"*86";
49 import static quid.QuotedIdent.#"MAKE-*86";
51 public class QuotedIdent2 {
52 static void check(int testid, String have, String expect)
53 throws RuntimeException {
54 QuotedIdent.check(testid, have, expect);
55 }
57 public static void main(String[] args) throws Exception {
58 String s;
60 s = #"int".valueOf(123).toString();
61 check(22, s, "123");
63 s = #"MAKE-*86"().#"555-1212"();
64 check(23, s, "[*86.555-1212]");
66 s = #"Yog-Shoggoth".#"(nameless ululation)";
67 check(25, s, "Tekeli-li!");
69 s = QuotedIdent.#"int".class.getName();
70 check(31, s, QuotedIdent.class.getName()+"$int");
72 Class x86 = Class.forName(QuotedIdent.class.getName()+"$*86");
73 if (x86 != #"*86".class)
74 check(32, "reflected "+x86, "static "+#"*86".class);
76 s = (String) x86.getDeclaredMethod("555-1212").invoke(QuotedIdent.#"MAKE-*86"());
77 check(31, s, "[*86.555-1212]");
79 System.out.println("OK");
80 }
81 }