changeset 384:74760fd5197f

6843707: bad tests generate files in the test/ directory 6876699: generated files in repository Reviewed-by: darcy
author jjg
date Thu, 27 Aug 2009 15:12:36 -0700
parents ed31953ca025
children 2c20f17c429c
files test/tools/javac/meth/InvokeMH_BAD68.java test/tools/javac/meth/InvokeMH_BAD72.java test/tools/javac/meth/MakeNegTests.sh test/tools/javac/quid/MakeNegTests.sh test/tools/javac/quid/QuotedIdent_BAD61.java test/tools/javac/quid/QuotedIdent_BAD62.java test/tools/javac/quid/QuotedIdent_BAD63.java
diffstat 7 files changed, 2 insertions(+), 548 deletions(-) [+]
line wrap: on
line diff
--- a/test/tools/javac/meth/InvokeMH_BAD68.java	Thu Aug 27 11:08:27 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * ##test
- * ##bug 6754038
- * ##summary Generate call sites for method handle
- * ##author jrose
- *
- * ##compile/fail -source 7 -target 7 InvokeMH_BAD68.java
- */
-
-/*
- * Standalone testing:
- * <code>
- * $ cd $MY_REPO_DIR/langtools
- * $ (cd make; make)
- * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/meth/InvokeMH_BAD68.java
- * $ javap -c -classpath dist meth.InvokeMH_BAD68
- * </code>
- */
-
-package meth;
-
-import java.dyn.MethodHandle;
-
-public class InvokeMH_BAD68 {
-    void test(MethodHandle mh_SiO,
-              MethodHandle mh_vS,
-              MethodHandle mh_vi,
-              MethodHandle mh_vv) {
-        Object o; String s; int i;  // for return type testing
-
-        // next five must have sig = (String,int)Object
-        mh_SiO.invoke("world", 123);
-        mh_SiO.invoke("mundus", 456);
-        Object k = "kosmos";
-        mh_SiO.invoke((String)k, 789);
-        o = mh_SiO.invoke((String)null, 000);
-        o = mh_SiO.<Object>invoke("arda", -123);
-
-        // sig = ()String
-        s = mh_vS.<String>invoke();
-
-        // sig = ()int
-        i = mh_vi.<int>invoke();
-        o = mh_vi.<int>invoke();
-    s = mh_vi.<int>invoke(); //BAD
-        mh_vi.<int>invoke();
-
-        // sig = ()void
-        //o = mh_vv.<void>invoke(); //BAD
-        mh_vv.<void>invoke();
-    }
-}
--- a/test/tools/javac/meth/InvokeMH_BAD72.java	Thu Aug 27 11:08:27 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * ##test
- * ##bug 6754038
- * ##summary Generate call sites for method handle
- * ##author jrose
- *
- * ##compile/fail -source 7 -target 7 InvokeMH_BAD72.java
- */
-
-/*
- * Standalone testing:
- * <code>
- * $ cd $MY_REPO_DIR/langtools
- * $ (cd make; make)
- * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/meth/InvokeMH_BAD72.java
- * $ javap -c -classpath dist meth.InvokeMH_BAD72
- * </code>
- */
-
-package meth;
-
-import java.dyn.MethodHandle;
-
-public class InvokeMH_BAD72 {
-    void test(MethodHandle mh_SiO,
-              MethodHandle mh_vS,
-              MethodHandle mh_vi,
-              MethodHandle mh_vv) {
-        Object o; String s; int i;  // for return type testing
-
-        // next five must have sig = (String,int)Object
-        mh_SiO.invoke("world", 123);
-        mh_SiO.invoke("mundus", 456);
-        Object k = "kosmos";
-        mh_SiO.invoke((String)k, 789);
-        o = mh_SiO.invoke((String)null, 000);
-        o = mh_SiO.<Object>invoke("arda", -123);
-
-        // sig = ()String
-        s = mh_vS.<String>invoke();
-
-        // sig = ()int
-        i = mh_vi.<int>invoke();
-        o = mh_vi.<int>invoke();
-        //s = mh_vi.<int>invoke(); //BAD
-        mh_vi.<int>invoke();
-
-        // sig = ()void
-    o = mh_vv.<void>invoke(); //BAD
-        mh_vv.<void>invoke();
-    }
-}
--- a/test/tools/javac/meth/MakeNegTests.sh	Thu Aug 27 11:08:27 2009 -0700
+++ b/test/tools/javac/meth/MakeNegTests.sh	Thu Aug 27 15:12:36 2009 -0700
@@ -78,7 +78,7 @@
 }
 
 getcasestem() {
-  echo "$1" | sed 's/\.java$//;s/_BAD[0-9]*$//;s/$/_BAD/'
+  echo `basename $1` | sed 's/\.java$//;s/_BAD[0-9]*$//;s/$/_BAD/'
 }
 
 testneg() {
--- a/test/tools/javac/quid/MakeNegTests.sh	Thu Aug 27 11:08:27 2009 -0700
+++ b/test/tools/javac/quid/MakeNegTests.sh	Thu Aug 27 15:12:36 2009 -0700
@@ -77,7 +77,7 @@
 }
 
 getcasestem() {
-  echo "$1" | sed 's/\.java$//;s/_BAD[0-9]*$//;s/$/_BAD/'
+  echo `basename $1` | sed 's/.*\///;s/\.java$//;s/_BAD[0-9]*$//;s/$/_BAD/'
 }
 
 testneg() {
--- a/test/tools/javac/quid/QuotedIdent_BAD61.java	Thu Aug 27 11:08:27 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * ##test
- * ##bug 6746458
- * ##summary Verify correct lexing of quoted identifiers.
- * ##author jrose
- *
- * ##library ..
- * ##run main quid.QuotedIdent_BAD61
- */
-
-/*
- * Standalone testing:
- * <code>
- * $ cd $MY_REPO_DIR/langtools
- * $ (cd make; make)
- * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent_BAD61.java
- * $ java -version  # should print 1.6 or later
- * $ java -cp dist quid.QuotedIdent_BAD61
- * </code>
- */
-
-package quid;
-
-public class QuotedIdent_BAD61 {
-    static void check(int testid, String have, String expect)
-                throws RuntimeException {
-        if ((have == null && have != expect) ||
-                (have != null && !have.equals(expect))) {
-            String msg =
-                "TEST " + testid + ": HAVE \"" +
-                have + "\" EXPECT \"" + expect + "\"";
-            System.out.println("StringConversion: " + msg);
-            throw new RuntimeException(msg);
-        }
-    }
-
-    // negative tests:
-    static class #"" { } //BAD empty ident name
-    //static class #"<foo>" { } //BAD bad char in ident name
-    /*static class /*(//BAD ident name interrupted by newline) #"jump:
-    " { } /* uncomment previous line to attempt class w/ bad name */
-
-    static class #"int" extends Number {
-        final int #"int";
-        #"int"(int #"int") {
-            this.#"int" = #"int";
-        }
-        static #"int" valueOf(int #"int") {
-            return new #"int"(#"int");
-        }
-        public int intValue() { return #"int"; }
-        public long longValue() { return #"int"; }
-        public float floatValue() { return #"int"; }
-        public double doubleValue() { return #"int"; }
-        public String toString() { return String.valueOf(#"int"); }
-    }
-
-    class #"*86" {
-        String #"555-1212"() { return "[*86.555-1212]"; }
-    }
-    static#"*86"#"MAKE-*86"() {   // note close spacing
-        return new QuotedIdent_BAD61().new#"*86"();
-    }
-
-    static String bar() { return "[bar]"; }
-
-    public static void main(String[] args) throws Exception {
-        String s;
-
-        String #"sticky \' wicket" = "wicked ' stick";
-        s = #"sticky ' wicket";
-        check(11, s, "wicked \' stick");
-        check(12, #"s", s);
-        check(13, #"\163", s);
-
-        s = #"QuotedIdent_BAD61".bar();
-        check(21, s, "[bar]");
-
-        s = #"int".valueOf(123).toString();
-        check(22, s, "123");
-
-        s = #"MAKE-*86"().#"555-1212"();
-        check(23, s, "[*86.555-1212]");
-
-        class#"{{{inmost}}}" { }
-        s = new#"{{{inmost}}}"().getClass().getName();
-        if (!s.endsWith("{{{inmost}}}"))
-            check(24, s, "should end with \"{{{inmost}}}\"");
-
-        s = #"Yog-Shoggoth".#"(nameless ululation)";
-        check(25, s, "Tekeli-li!");
-
-        s = #"int".class.getName();
-        check(31, s, QuotedIdent_BAD61.class.getName()+"$int");
-
-        Class x86 = Class.forName(QuotedIdent_BAD61.class.getName()+"$*86");
-        if (x86 != #"*86".class)
-            check(32, "reflected "+x86, "static "+#"*86".class);
-
-        s = (String) x86.getDeclaredMethod("555-1212").invoke(#"MAKE-*86"());
-        check(31, s, "[*86.555-1212]");
-
-        System.out.println("OK");
-    }
-}
-
-interface #"Yog-Shoggoth" {
-    final String #"(nameless ululation)" = "Tekeli-li!";
-}
--- a/test/tools/javac/quid/QuotedIdent_BAD62.java	Thu Aug 27 11:08:27 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * ##test
- * ##bug 6746458
- * ##summary Verify correct lexing of quoted identifiers.
- * ##author jrose
- *
- * ##library ..
- * ##run main quid.QuotedIdent_BAD62
- */
-
-/*
- * Standalone testing:
- * <code>
- * $ cd $MY_REPO_DIR/langtools
- * $ (cd make; make)
- * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent_BAD62.java
- * $ java -version  # should print 1.6 or later
- * $ java -cp dist quid.QuotedIdent_BAD62
- * </code>
- */
-
-package quid;
-
-public class QuotedIdent_BAD62 {
-    static void check(int testid, String have, String expect)
-                throws RuntimeException {
-        if ((have == null && have != expect) ||
-                (have != null && !have.equals(expect))) {
-            String msg =
-                "TEST " + testid + ": HAVE \"" +
-                have + "\" EXPECT \"" + expect + "\"";
-            System.out.println("StringConversion: " + msg);
-            throw new RuntimeException(msg);
-        }
-    }
-
-    // negative tests:
-    //static class #"" { } //BAD empty ident name
-    static class #"<foo>" { } //BAD bad char in ident name
-    /*static class /*(//BAD ident name interrupted by newline) #"jump:
-    " { } /* uncomment previous line to attempt class w/ bad name */
-
-    static class #"int" extends Number {
-        final int #"int";
-        #"int"(int #"int") {
-            this.#"int" = #"int";
-        }
-        static #"int" valueOf(int #"int") {
-            return new #"int"(#"int");
-        }
-        public int intValue() { return #"int"; }
-        public long longValue() { return #"int"; }
-        public float floatValue() { return #"int"; }
-        public double doubleValue() { return #"int"; }
-        public String toString() { return String.valueOf(#"int"); }
-    }
-
-    class #"*86" {
-        String #"555-1212"() { return "[*86.555-1212]"; }
-    }
-    static#"*86"#"MAKE-*86"() {   // note close spacing
-        return new QuotedIdent_BAD62().new#"*86"();
-    }
-
-    static String bar() { return "[bar]"; }
-
-    public static void main(String[] args) throws Exception {
-        String s;
-
-        String #"sticky \' wicket" = "wicked ' stick";
-        s = #"sticky ' wicket";
-        check(11, s, "wicked \' stick");
-        check(12, #"s", s);
-        check(13, #"\163", s);
-
-        s = #"QuotedIdent_BAD62".bar();
-        check(21, s, "[bar]");
-
-        s = #"int".valueOf(123).toString();
-        check(22, s, "123");
-
-        s = #"MAKE-*86"().#"555-1212"();
-        check(23, s, "[*86.555-1212]");
-
-        class#"{{{inmost}}}" { }
-        s = new#"{{{inmost}}}"().getClass().getName();
-        if (!s.endsWith("{{{inmost}}}"))
-            check(24, s, "should end with \"{{{inmost}}}\"");
-
-        s = #"Yog-Shoggoth".#"(nameless ululation)";
-        check(25, s, "Tekeli-li!");
-
-        s = #"int".class.getName();
-        check(31, s, QuotedIdent_BAD62.class.getName()+"$int");
-
-        Class x86 = Class.forName(QuotedIdent_BAD62.class.getName()+"$*86");
-        if (x86 != #"*86".class)
-            check(32, "reflected "+x86, "static "+#"*86".class);
-
-        s = (String) x86.getDeclaredMethod("555-1212").invoke(#"MAKE-*86"());
-        check(31, s, "[*86.555-1212]");
-
-        System.out.println("OK");
-    }
-}
-
-interface #"Yog-Shoggoth" {
-    final String #"(nameless ululation)" = "Tekeli-li!";
-}
--- a/test/tools/javac/quid/QuotedIdent_BAD63.java	Thu Aug 27 11:08:27 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * ##test
- * ##bug 6746458
- * ##summary Verify correct lexing of quoted identifiers.
- * ##author jrose
- *
- * ##library ..
- * ##run main quid.QuotedIdent_BAD63
- */
-
-/*
- * Standalone testing:
- * <code>
- * $ cd $MY_REPO_DIR/langtools
- * $ (cd make; make)
- * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/quid/QuotedIdent_BAD63.java
- * $ java -version  # should print 1.6 or later
- * $ java -cp dist quid.QuotedIdent_BAD63
- * </code>
- */
-
-package quid;
-
-public class QuotedIdent_BAD63 {
-    static void check(int testid, String have, String expect)
-                throws RuntimeException {
-        if ((have == null && have != expect) ||
-                (have != null && !have.equals(expect))) {
-            String msg =
-                "TEST " + testid + ": HAVE \"" +
-                have + "\" EXPECT \"" + expect + "\"";
-            System.out.println("StringConversion: " + msg);
-            throw new RuntimeException(msg);
-        }
-    }
-
-    // negative tests:
-    //static class #"" { } //BAD empty ident name
-    //static class #"<foo>" { } //BAD bad char in ident name
-    static class /*(//BAD ident name interrupted by newline) #"jump:
-    " { } /* uncomment previous line to attempt class w/ bad name */
-
-    static class #"int" extends Number {
-        final int #"int";
-        #"int"(int #"int") {
-            this.#"int" = #"int";
-        }
-        static #"int" valueOf(int #"int") {
-            return new #"int"(#"int");
-        }
-        public int intValue() { return #"int"; }
-        public long longValue() { return #"int"; }
-        public float floatValue() { return #"int"; }
-        public double doubleValue() { return #"int"; }
-        public String toString() { return String.valueOf(#"int"); }
-    }
-
-    class #"*86" {
-        String #"555-1212"() { return "[*86.555-1212]"; }
-    }
-    static#"*86"#"MAKE-*86"() {   // note close spacing
-        return new QuotedIdent_BAD63().new#"*86"();
-    }
-
-    static String bar() { return "[bar]"; }
-
-    public static void main(String[] args) throws Exception {
-        String s;
-
-        String #"sticky \' wicket" = "wicked ' stick";
-        s = #"sticky ' wicket";
-        check(11, s, "wicked \' stick");
-        check(12, #"s", s);
-        check(13, #"\163", s);
-
-        s = #"QuotedIdent_BAD63".bar();
-        check(21, s, "[bar]");
-
-        s = #"int".valueOf(123).toString();
-        check(22, s, "123");
-
-        s = #"MAKE-*86"().#"555-1212"();
-        check(23, s, "[*86.555-1212]");
-
-        class#"{{{inmost}}}" { }
-        s = new#"{{{inmost}}}"().getClass().getName();
-        if (!s.endsWith("{{{inmost}}}"))
-            check(24, s, "should end with \"{{{inmost}}}\"");
-
-        s = #"Yog-Shoggoth".#"(nameless ululation)";
-        check(25, s, "Tekeli-li!");
-
-        s = #"int".class.getName();
-        check(31, s, QuotedIdent_BAD63.class.getName()+"$int");
-
-        Class x86 = Class.forName(QuotedIdent_BAD63.class.getName()+"$*86");
-        if (x86 != #"*86".class)
-            check(32, "reflected "+x86, "static "+#"*86".class);
-
-        s = (String) x86.getDeclaredMethod("555-1212").invoke(#"MAKE-*86"());
-        check(31, s, "[*86.555-1212]");
-
-        System.out.println("OK");
-    }
-}
-
-interface #"Yog-Shoggoth" {
-    final String #"(nameless ululation)" = "Tekeli-li!";
-}