jrose@267: /* jrose@267: * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. jrose@267: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jrose@267: * jrose@267: * This code is free software; you can redistribute it and/or modify it jrose@267: * under the terms of the GNU General Public License version 2 only, as jrose@267: * published by the Free Software Foundation. jrose@267: * jrose@267: * This code is distributed in the hope that it will be useful, but WITHOUT jrose@267: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jrose@267: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jrose@267: * version 2 for more details (a copy is included in the LICENSE file that jrose@267: * accompanied this code). jrose@267: * jrose@267: * You should have received a copy of the GNU General Public License version jrose@267: * 2 along with this work; if not, write to the Free Software Foundation, jrose@267: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jrose@267: * jrose@267: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, jrose@267: * CA 95054 USA or visit www.sun.com if you need additional information or jrose@267: * have any questions. jrose@267: */ jrose@267: jrose@267: /* jrose@267: * @test jrose@267: * @bug 6746458 jrose@267: * @summary Verify correct separate compilation of classes with extended identifiers. jrose@267: * @author jrose jrose@267: * jrose@267: * @library .. jrose@267: * @run main quid.QuotedIdent2 jrose@267: */ jrose@267: /* jrose@267: * Standalone testing: jrose@267: * jrose@267: * $ cd $MY_REPO_DIR/langtools jrose@267: * $ (cd make; make) jrose@267: * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent.java jrose@267: * $ ./dist/bootstrap/bin/javac -d dist -cp dist test/tools/javac/quid/QuotedIdent2.java jrose@267: * $ java -version # should print 1.6 or later jrose@267: * $ java -cp dist QuotedIdent2 jrose@267: * jrose@267: */ jrose@267: jrose@267: package quid; jrose@267: jrose@267: import quid.QuotedIdent.*; jrose@267: import quid.QuotedIdent.#"*86"; jrose@267: import static quid.QuotedIdent.#"MAKE-*86"; jrose@267: jrose@267: public class QuotedIdent2 { jrose@267: static void check(int testid, String have, String expect) jrose@267: throws RuntimeException { jrose@267: QuotedIdent.check(testid, have, expect); jrose@267: } jrose@267: jrose@267: public static void main(String[] args) throws Exception { jrose@267: String s; jrose@267: jrose@267: s = #"int".valueOf(123).toString(); jrose@267: check(22, s, "123"); jrose@267: jrose@267: s = #"MAKE-*86"().#"555-1212"(); jrose@267: check(23, s, "[*86.555-1212]"); jrose@267: jrose@267: s = #"Yog-Shoggoth".#"(nameless ululation)"; jrose@267: check(25, s, "Tekeli-li!"); jrose@267: jrose@267: s = QuotedIdent.#"int".class.getName(); jrose@267: check(31, s, QuotedIdent.class.getName()+"$int"); jrose@267: jrose@267: Class x86 = Class.forName(QuotedIdent.class.getName()+"$*86"); jrose@267: if (x86 != #"*86".class) jrose@267: check(32, "reflected "+x86, "static "+#"*86".class); jrose@267: jrose@267: s = (String) x86.getDeclaredMethod("555-1212").invoke(QuotedIdent.#"MAKE-*86"()); jrose@267: check(31, s, "[*86.555-1212]"); jrose@267: jrose@267: System.out.println("OK"); jrose@267: } jrose@267: }