8014230: Compilation incorrectly succeeds with inner class constructor with 254 parameters
Summary: The compiler does not account fr extra parameters due to inner this parameters
Reviewed-by: jjg
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Wed Jun 26 20:45:47 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Jun 27 00:37:13 2013 -0400
@@ -991,9 +991,19 @@
*/
void genMethod(JCMethodDecl tree, Env<GenContext> env, boolean fatcode) {
MethodSymbol meth = tree.sym;
-// System.err.println("Generating " + meth + " in " + meth.owner); //DEBUG
- if (Code.width(types.erasure(env.enclMethod.sym.type).getParameterTypes()) +
- (((tree.mods.flags & STATIC) == 0 || meth.isConstructor()) ? 1 : 0) >
+ int extras = 0;
+ // Count up extra parameters
+ if (meth.isConstructor()) {
+ extras++;
+ if (meth.enclClass().isInner() &&
+ !meth.enclClass().isStatic()) {
+ extras++;
+ }
+ } else if ((tree.mods.flags & STATIC) == 0) {
+ extras++;
+ }
+ // System.err.println("Generating " + meth + " in " + meth.owner); //DEBUG
+ if (Code.width(types.erasure(env.enclMethod.sym.type).getParameterTypes()) + extras >
ClassFile.MAX_PARAMETERS) {
log.error(tree.pos(), "limit.parameters");
nerrs++;
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Wed Jun 26 20:45:47 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Thu Jun 27 00:37:13 2013 -0400
@@ -377,10 +377,10 @@
}
public Result compile(String[] args,
- String[] classNames,
- Context context,
- List<JavaFileObject> fileObjects,
- Iterable<? extends Processor> processors)
+ String[] classNames,
+ Context context,
+ List<JavaFileObject> fileObjects,
+ Iterable<? extends Processor> processors)
{
context.put(Log.outKey, out);
log = Log.instance(context);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/NestedClassConstructorArgs.java Thu Jun 27 00:37:13 2013 -0400
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8014230
+ * @summary Compiler silently generates bytecode that exceeds VM limits
+ * @compile NumArgsTest.java
+ * @run main NestedClassConstructorArgs
+ */
+
+public class NestedClassConstructorArgs extends NumArgsTest {
+ private static final NumArgsTest.NestingDef[] nesting = {
+ classNesting("Inner")
+ };
+
+ private NestedClassConstructorArgs() {
+ super(253, "NestedClassConstructorArgs", "Inner", nesting);
+ }
+
+ public static void main(String... args) throws Exception {
+ new NestedClassConstructorArgs().runTest();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/NestedClassMethodArgs.java Thu Jun 27 00:37:13 2013 -0400
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8014230
+ * @summary Compiler silently generates bytecode that exceeds VM limits
+ * @compile NumArgsTest.java
+ * @run main NestedClassMethodArgs
+ */
+
+public class NestedClassMethodArgs extends NumArgsTest {
+ private static final NumArgsTest.NestingDef[] nesting = {
+ classNesting("Inner")
+ };
+
+ private NestedClassMethodArgs() {
+ super(254, "void", "test", "NestedClassMethodArgs", nesting);
+ }
+
+ public static void main(String... args) throws Exception {
+ new NestedClassMethodArgs().runTest();
+ }
+}
+
--- a/langtools/test/tools/javac/limits/NumArgs1.java Wed Jun 26 20:45:47 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,552 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4309152
- * @summary Compiler silently generates bytecode that exceeds VM limits
- * @author gafter
- *
- * @compile/fail NumArgs1.java
- */
-
-class NumArgs1 {
- void f(
- // T1 this,
- int x2,
- int x3,
- int x4,
- int x5,
- int x6,
- int x7,
- int x8,
- int x9,
- int x10,
- int x11,
- int x12,
- int x13,
- int x14,
- int x15,
- int x16,
- int x17,
- int x18,
- int x19,
- int x20,
- int x21,
- int x22,
- int x23,
- int x24,
- int x25,
- int x26,
- int x27,
- int x28,
- int x29,
- int x30,
- int x31,
- int x32,
- int x33,
- int x34,
- int x35,
- int x36,
- int x37,
- int x38,
- int x39,
- int x40,
- int x41,
- int x42,
- int x43,
- int x44,
- int x45,
- int x46,
- int x47,
- int x48,
- int x49,
- int x50,
- int x51,
- int x52,
- int x53,
- int x54,
- int x55,
- int x56,
- int x57,
- int x58,
- int x59,
- int x60,
- int x61,
- int x62,
- int x63,
- int x64,
- int x65,
- int x66,
- int x67,
- int x68,
- int x69,
- int x70,
- int x71,
- int x72,
- int x73,
- int x74,
- int x75,
- int x76,
- int x77,
- int x78,
- int x79,
- int x80,
- int x81,
- int x82,
- int x83,
- int x84,
- int x85,
- int x86,
- int x87,
- int x88,
- int x89,
- int x90,
- int x91,
- int x92,
- int x93,
- int x94,
- int x95,
- int x96,
- int x97,
- int x98,
- int x99,
- int x100,
- int x101,
- int x102,
- int x103,
- int x104,
- int x105,
- int x106,
- int x107,
- int x108,
- int x109,
- int x110,
- int x111,
- int x112,
- int x113,
- int x114,
- int x115,
- int x116,
- int x117,
- int x118,
- int x119,
- int x120,
- int x121,
- int x122,
- int x123,
- int x124,
- int x125,
- int x126,
- int x127,
- int x128,
- int x129,
- int x130,
- int x131,
- int x132,
- int x133,
- int x134,
- int x135,
- int x136,
- int x137,
- int x138,
- int x139,
- int x140,
- int x141,
- int x142,
- int x143,
- int x144,
- int x145,
- int x146,
- int x147,
- int x148,
- int x149,
- int x150,
- int x151,
- int x152,
- int x153,
- int x154,
- int x155,
- int x156,
- int x157,
- int x158,
- int x159,
- int x160,
- int x161,
- int x162,
- int x163,
- int x164,
- int x165,
- int x166,
- int x167,
- int x168,
- int x169,
- int x170,
- int x171,
- int x172,
- int x173,
- int x174,
- int x175,
- int x176,
- int x177,
- int x178,
- int x179,
- int x180,
- int x181,
- int x182,
- int x183,
- int x184,
- int x185,
- int x186,
- int x187,
- int x188,
- int x189,
- int x190,
- int x191,
- int x192,
- int x193,
- int x194,
- int x195,
- int x196,
- int x197,
- int x198,
- int x199,
- int x200,
- int x201,
- int x202,
- int x203,
- int x204,
- int x205,
- int x206,
- int x207,
- int x208,
- int x209,
- int x210,
- int x211,
- int x212,
- int x213,
- int x214,
- int x215,
- int x216,
- int x217,
- int x218,
- int x219,
- int x220,
- int x221,
- int x222,
- int x223,
- int x224,
- int x225,
- int x226,
- int x227,
- int x228,
- int x229,
- int x230,
- int x231,
- int x232,
- int x233,
- int x234,
- int x235,
- int x236,
- int x237,
- int x238,
- int x239,
- int x240,
- int x241,
- int x242,
- int x243,
- int x244,
- int x245,
- int x246,
- int x247,
- int x248,
- int x249,
- int x250,
- int x251,
- int x252,
- int x253,
- int x254,
- int x255,
- int x256
- ) {}
-
- static
- void g(
- int x1,
- int x2,
- int x3,
- int x4,
- int x5,
- int x6,
- int x7,
- int x8,
- int x9,
- int x10,
- int x11,
- int x12,
- int x13,
- int x14,
- int x15,
- int x16,
- int x17,
- int x18,
- int x19,
- int x20,
- int x21,
- int x22,
- int x23,
- int x24,
- int x25,
- int x26,
- int x27,
- int x28,
- int x29,
- int x30,
- int x31,
- int x32,
- int x33,
- int x34,
- int x35,
- int x36,
- int x37,
- int x38,
- int x39,
- int x40,
- int x41,
- int x42,
- int x43,
- int x44,
- int x45,
- int x46,
- int x47,
- int x48,
- int x49,
- int x50,
- int x51,
- int x52,
- int x53,
- int x54,
- int x55,
- int x56,
- int x57,
- int x58,
- int x59,
- int x60,
- int x61,
- int x62,
- int x63,
- int x64,
- int x65,
- int x66,
- int x67,
- int x68,
- int x69,
- int x70,
- int x71,
- int x72,
- int x73,
- int x74,
- int x75,
- int x76,
- int x77,
- int x78,
- int x79,
- int x80,
- int x81,
- int x82,
- int x83,
- int x84,
- int x85,
- int x86,
- int x87,
- int x88,
- int x89,
- int x90,
- int x91,
- int x92,
- int x93,
- int x94,
- int x95,
- int x96,
- int x97,
- int x98,
- int x99,
- int x100,
- int x101,
- int x102,
- int x103,
- int x104,
- int x105,
- int x106,
- int x107,
- int x108,
- int x109,
- int x110,
- int x111,
- int x112,
- int x113,
- int x114,
- int x115,
- int x116,
- int x117,
- int x118,
- int x119,
- int x120,
- int x121,
- int x122,
- int x123,
- int x124,
- int x125,
- int x126,
- int x127,
- int x128,
- int x129,
- int x130,
- int x131,
- int x132,
- int x133,
- int x134,
- int x135,
- int x136,
- int x137,
- int x138,
- int x139,
- int x140,
- int x141,
- int x142,
- int x143,
- int x144,
- int x145,
- int x146,
- int x147,
- int x148,
- int x149,
- int x150,
- int x151,
- int x152,
- int x153,
- int x154,
- int x155,
- int x156,
- int x157,
- int x158,
- int x159,
- int x160,
- int x161,
- int x162,
- int x163,
- int x164,
- int x165,
- int x166,
- int x167,
- int x168,
- int x169,
- int x170,
- int x171,
- int x172,
- int x173,
- int x174,
- int x175,
- int x176,
- int x177,
- int x178,
- int x179,
- int x180,
- int x181,
- int x182,
- int x183,
- int x184,
- int x185,
- int x186,
- int x187,
- int x188,
- int x189,
- int x190,
- int x191,
- int x192,
- int x193,
- int x194,
- int x195,
- int x196,
- int x197,
- int x198,
- int x199,
- int x200,
- int x201,
- int x202,
- int x203,
- int x204,
- int x205,
- int x206,
- int x207,
- int x208,
- int x209,
- int x210,
- int x211,
- int x212,
- int x213,
- int x214,
- int x215,
- int x216,
- int x217,
- int x218,
- int x219,
- int x220,
- int x221,
- int x222,
- int x223,
- int x224,
- int x225,
- int x226,
- int x227,
- int x228,
- int x229,
- int x230,
- int x231,
- int x232,
- int x233,
- int x234,
- int x235,
- int x236,
- int x237,
- int x238,
- int x239,
- int x240,
- int x241,
- int x242,
- int x243,
- int x244,
- int x245,
- int x246,
- int x247,
- int x248,
- int x249,
- int x250,
- int x251,
- int x252,
- int x253,
- int x254,
- int x255,
- int x256
- ) {}
-}
--- a/langtools/test/tools/javac/limits/NumArgs2.java Wed Jun 26 20:45:47 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,550 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4309152
- * @summary Compiler silently generates bytecode that exceeds VM limits
- * @author gafter
- *
- * @compile NumArgs2.java
- */
-
-class NumArgs2 {
- void f(
- // This this,
- int x2,
- int x3,
- int x4,
- int x5,
- int x6,
- int x7,
- int x8,
- int x9,
- int x10,
- int x11,
- int x12,
- int x13,
- int x14,
- int x15,
- int x16,
- int x17,
- int x18,
- int x19,
- int x20,
- int x21,
- int x22,
- int x23,
- int x24,
- int x25,
- int x26,
- int x27,
- int x28,
- int x29,
- int x30,
- int x31,
- int x32,
- int x33,
- int x34,
- int x35,
- int x36,
- int x37,
- int x38,
- int x39,
- int x40,
- int x41,
- int x42,
- int x43,
- int x44,
- int x45,
- int x46,
- int x47,
- int x48,
- int x49,
- int x50,
- int x51,
- int x52,
- int x53,
- int x54,
- int x55,
- int x56,
- int x57,
- int x58,
- int x59,
- int x60,
- int x61,
- int x62,
- int x63,
- int x64,
- int x65,
- int x66,
- int x67,
- int x68,
- int x69,
- int x70,
- int x71,
- int x72,
- int x73,
- int x74,
- int x75,
- int x76,
- int x77,
- int x78,
- int x79,
- int x80,
- int x81,
- int x82,
- int x83,
- int x84,
- int x85,
- int x86,
- int x87,
- int x88,
- int x89,
- int x90,
- int x91,
- int x92,
- int x93,
- int x94,
- int x95,
- int x96,
- int x97,
- int x98,
- int x99,
- int x100,
- int x101,
- int x102,
- int x103,
- int x104,
- int x105,
- int x106,
- int x107,
- int x108,
- int x109,
- int x110,
- int x111,
- int x112,
- int x113,
- int x114,
- int x115,
- int x116,
- int x117,
- int x118,
- int x119,
- int x120,
- int x121,
- int x122,
- int x123,
- int x124,
- int x125,
- int x126,
- int x127,
- int x128,
- int x129,
- int x130,
- int x131,
- int x132,
- int x133,
- int x134,
- int x135,
- int x136,
- int x137,
- int x138,
- int x139,
- int x140,
- int x141,
- int x142,
- int x143,
- int x144,
- int x145,
- int x146,
- int x147,
- int x148,
- int x149,
- int x150,
- int x151,
- int x152,
- int x153,
- int x154,
- int x155,
- int x156,
- int x157,
- int x158,
- int x159,
- int x160,
- int x161,
- int x162,
- int x163,
- int x164,
- int x165,
- int x166,
- int x167,
- int x168,
- int x169,
- int x170,
- int x171,
- int x172,
- int x173,
- int x174,
- int x175,
- int x176,
- int x177,
- int x178,
- int x179,
- int x180,
- int x181,
- int x182,
- int x183,
- int x184,
- int x185,
- int x186,
- int x187,
- int x188,
- int x189,
- int x190,
- int x191,
- int x192,
- int x193,
- int x194,
- int x195,
- int x196,
- int x197,
- int x198,
- int x199,
- int x200,
- int x201,
- int x202,
- int x203,
- int x204,
- int x205,
- int x206,
- int x207,
- int x208,
- int x209,
- int x210,
- int x211,
- int x212,
- int x213,
- int x214,
- int x215,
- int x216,
- int x217,
- int x218,
- int x219,
- int x220,
- int x221,
- int x222,
- int x223,
- int x224,
- int x225,
- int x226,
- int x227,
- int x228,
- int x229,
- int x230,
- int x231,
- int x232,
- int x233,
- int x234,
- int x235,
- int x236,
- int x237,
- int x238,
- int x239,
- int x240,
- int x241,
- int x242,
- int x243,
- int x244,
- int x245,
- int x246,
- int x247,
- int x248,
- int x249,
- int x250,
- int x251,
- int x252,
- int x253,
- int x254,
- int x255
- ) {}
-
- static
- void g(
- int x1,
- int x2,
- int x3,
- int x4,
- int x5,
- int x6,
- int x7,
- int x8,
- int x9,
- int x10,
- int x11,
- int x12,
- int x13,
- int x14,
- int x15,
- int x16,
- int x17,
- int x18,
- int x19,
- int x20,
- int x21,
- int x22,
- int x23,
- int x24,
- int x25,
- int x26,
- int x27,
- int x28,
- int x29,
- int x30,
- int x31,
- int x32,
- int x33,
- int x34,
- int x35,
- int x36,
- int x37,
- int x38,
- int x39,
- int x40,
- int x41,
- int x42,
- int x43,
- int x44,
- int x45,
- int x46,
- int x47,
- int x48,
- int x49,
- int x50,
- int x51,
- int x52,
- int x53,
- int x54,
- int x55,
- int x56,
- int x57,
- int x58,
- int x59,
- int x60,
- int x61,
- int x62,
- int x63,
- int x64,
- int x65,
- int x66,
- int x67,
- int x68,
- int x69,
- int x70,
- int x71,
- int x72,
- int x73,
- int x74,
- int x75,
- int x76,
- int x77,
- int x78,
- int x79,
- int x80,
- int x81,
- int x82,
- int x83,
- int x84,
- int x85,
- int x86,
- int x87,
- int x88,
- int x89,
- int x90,
- int x91,
- int x92,
- int x93,
- int x94,
- int x95,
- int x96,
- int x97,
- int x98,
- int x99,
- int x100,
- int x101,
- int x102,
- int x103,
- int x104,
- int x105,
- int x106,
- int x107,
- int x108,
- int x109,
- int x110,
- int x111,
- int x112,
- int x113,
- int x114,
- int x115,
- int x116,
- int x117,
- int x118,
- int x119,
- int x120,
- int x121,
- int x122,
- int x123,
- int x124,
- int x125,
- int x126,
- int x127,
- int x128,
- int x129,
- int x130,
- int x131,
- int x132,
- int x133,
- int x134,
- int x135,
- int x136,
- int x137,
- int x138,
- int x139,
- int x140,
- int x141,
- int x142,
- int x143,
- int x144,
- int x145,
- int x146,
- int x147,
- int x148,
- int x149,
- int x150,
- int x151,
- int x152,
- int x153,
- int x154,
- int x155,
- int x156,
- int x157,
- int x158,
- int x159,
- int x160,
- int x161,
- int x162,
- int x163,
- int x164,
- int x165,
- int x166,
- int x167,
- int x168,
- int x169,
- int x170,
- int x171,
- int x172,
- int x173,
- int x174,
- int x175,
- int x176,
- int x177,
- int x178,
- int x179,
- int x180,
- int x181,
- int x182,
- int x183,
- int x184,
- int x185,
- int x186,
- int x187,
- int x188,
- int x189,
- int x190,
- int x191,
- int x192,
- int x193,
- int x194,
- int x195,
- int x196,
- int x197,
- int x198,
- int x199,
- int x200,
- int x201,
- int x202,
- int x203,
- int x204,
- int x205,
- int x206,
- int x207,
- int x208,
- int x209,
- int x210,
- int x211,
- int x212,
- int x213,
- int x214,
- int x215,
- int x216,
- int x217,
- int x218,
- int x219,
- int x220,
- int x221,
- int x222,
- int x223,
- int x224,
- int x225,
- int x226,
- int x227,
- int x228,
- int x229,
- int x230,
- int x231,
- int x232,
- int x233,
- int x234,
- int x235,
- int x236,
- int x237,
- int x238,
- int x239,
- int x240,
- int x241,
- int x242,
- int x243,
- int x244,
- int x245,
- int x246,
- int x247,
- int x248,
- int x249,
- int x250,
- int x251,
- int x252,
- int x253,
- int x254,
- int x255
- ) {}
-}
--- a/langtools/test/tools/javac/limits/NumArgs3.java Wed Jun 26 20:45:47 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4309152
- * @summary Compiler silently generates bytecode that exceeds VM limits
- * @author gafter
- *
- * @compile/fail NumArgs3.java
- */
-
-class NumArgs3 {
- void NumArgs3(
- // T1 this,
- int x2,
- int x3,
- int x4,
- int x5,
- int x6,
- int x7,
- int x8,
- int x9,
- int x10,
- int x11,
- int x12,
- int x13,
- int x14,
- int x15,
- int x16,
- int x17,
- int x18,
- int x19,
- int x20,
- int x21,
- int x22,
- int x23,
- int x24,
- int x25,
- int x26,
- int x27,
- int x28,
- int x29,
- int x30,
- int x31,
- int x32,
- int x33,
- int x34,
- int x35,
- int x36,
- int x37,
- int x38,
- int x39,
- int x40,
- int x41,
- int x42,
- int x43,
- int x44,
- int x45,
- int x46,
- int x47,
- int x48,
- int x49,
- int x50,
- int x51,
- int x52,
- int x53,
- int x54,
- int x55,
- int x56,
- int x57,
- int x58,
- int x59,
- int x60,
- int x61,
- int x62,
- int x63,
- int x64,
- int x65,
- int x66,
- int x67,
- int x68,
- int x69,
- int x70,
- int x71,
- int x72,
- int x73,
- int x74,
- int x75,
- int x76,
- int x77,
- int x78,
- int x79,
- int x80,
- int x81,
- int x82,
- int x83,
- int x84,
- int x85,
- int x86,
- int x87,
- int x88,
- int x89,
- int x90,
- int x91,
- int x92,
- int x93,
- int x94,
- int x95,
- int x96,
- int x97,
- int x98,
- int x99,
- int x100,
- int x101,
- int x102,
- int x103,
- int x104,
- int x105,
- int x106,
- int x107,
- int x108,
- int x109,
- int x110,
- int x111,
- int x112,
- int x113,
- int x114,
- int x115,
- int x116,
- int x117,
- int x118,
- int x119,
- int x120,
- int x121,
- int x122,
- int x123,
- int x124,
- int x125,
- int x126,
- int x127,
- int x128,
- int x129,
- int x130,
- int x131,
- int x132,
- int x133,
- int x134,
- int x135,
- int x136,
- int x137,
- int x138,
- int x139,
- int x140,
- int x141,
- int x142,
- int x143,
- int x144,
- int x145,
- int x146,
- int x147,
- int x148,
- int x149,
- int x150,
- int x151,
- int x152,
- int x153,
- int x154,
- int x155,
- int x156,
- int x157,
- int x158,
- int x159,
- int x160,
- int x161,
- int x162,
- int x163,
- int x164,
- int x165,
- int x166,
- int x167,
- int x168,
- int x169,
- int x170,
- int x171,
- int x172,
- int x173,
- int x174,
- int x175,
- int x176,
- int x177,
- int x178,
- int x179,
- int x180,
- int x181,
- int x182,
- int x183,
- int x184,
- int x185,
- int x186,
- int x187,
- int x188,
- int x189,
- int x190,
- int x191,
- int x192,
- int x193,
- int x194,
- int x195,
- int x196,
- int x197,
- int x198,
- int x199,
- int x200,
- int x201,
- int x202,
- int x203,
- int x204,
- int x205,
- int x206,
- int x207,
- int x208,
- int x209,
- int x210,
- int x211,
- int x212,
- int x213,
- int x214,
- int x215,
- int x216,
- int x217,
- int x218,
- int x219,
- int x220,
- int x221,
- int x222,
- int x223,
- int x224,
- int x225,
- int x226,
- int x227,
- int x228,
- int x229,
- int x230,
- int x231,
- int x232,
- int x233,
- int x234,
- int x235,
- int x236,
- int x237,
- int x238,
- int x239,
- int x240,
- int x241,
- int x242,
- int x243,
- int x244,
- int x245,
- int x246,
- int x247,
- int x248,
- int x249,
- int x250,
- int x251,
- int x252,
- int x253,
- int x254,
- int x255,
- int x256
- ) {}
-}
--- a/langtools/test/tools/javac/limits/NumArgs4.java Wed Jun 26 20:45:47 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 2002, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4309152
- * @summary Compiler silently generates bytecode that exceeds VM limits
- * @author gafter
- *
- * @compile NumArgs4.java
- */
-
-class NumArgs4 {
- void NumArgs4(
- // T1 this,
- int x2,
- int x3,
- int x4,
- int x5,
- int x6,
- int x7,
- int x8,
- int x9,
- int x10,
- int x11,
- int x12,
- int x13,
- int x14,
- int x15,
- int x16,
- int x17,
- int x18,
- int x19,
- int x20,
- int x21,
- int x22,
- int x23,
- int x24,
- int x25,
- int x26,
- int x27,
- int x28,
- int x29,
- int x30,
- int x31,
- int x32,
- int x33,
- int x34,
- int x35,
- int x36,
- int x37,
- int x38,
- int x39,
- int x40,
- int x41,
- int x42,
- int x43,
- int x44,
- int x45,
- int x46,
- int x47,
- int x48,
- int x49,
- int x50,
- int x51,
- int x52,
- int x53,
- int x54,
- int x55,
- int x56,
- int x57,
- int x58,
- int x59,
- int x60,
- int x61,
- int x62,
- int x63,
- int x64,
- int x65,
- int x66,
- int x67,
- int x68,
- int x69,
- int x70,
- int x71,
- int x72,
- int x73,
- int x74,
- int x75,
- int x76,
- int x77,
- int x78,
- int x79,
- int x80,
- int x81,
- int x82,
- int x83,
- int x84,
- int x85,
- int x86,
- int x87,
- int x88,
- int x89,
- int x90,
- int x91,
- int x92,
- int x93,
- int x94,
- int x95,
- int x96,
- int x97,
- int x98,
- int x99,
- int x100,
- int x101,
- int x102,
- int x103,
- int x104,
- int x105,
- int x106,
- int x107,
- int x108,
- int x109,
- int x110,
- int x111,
- int x112,
- int x113,
- int x114,
- int x115,
- int x116,
- int x117,
- int x118,
- int x119,
- int x120,
- int x121,
- int x122,
- int x123,
- int x124,
- int x125,
- int x126,
- int x127,
- int x128,
- int x129,
- int x130,
- int x131,
- int x132,
- int x133,
- int x134,
- int x135,
- int x136,
- int x137,
- int x138,
- int x139,
- int x140,
- int x141,
- int x142,
- int x143,
- int x144,
- int x145,
- int x146,
- int x147,
- int x148,
- int x149,
- int x150,
- int x151,
- int x152,
- int x153,
- int x154,
- int x155,
- int x156,
- int x157,
- int x158,
- int x159,
- int x160,
- int x161,
- int x162,
- int x163,
- int x164,
- int x165,
- int x166,
- int x167,
- int x168,
- int x169,
- int x170,
- int x171,
- int x172,
- int x173,
- int x174,
- int x175,
- int x176,
- int x177,
- int x178,
- int x179,
- int x180,
- int x181,
- int x182,
- int x183,
- int x184,
- int x185,
- int x186,
- int x187,
- int x188,
- int x189,
- int x190,
- int x191,
- int x192,
- int x193,
- int x194,
- int x195,
- int x196,
- int x197,
- int x198,
- int x199,
- int x200,
- int x201,
- int x202,
- int x203,
- int x204,
- int x205,
- int x206,
- int x207,
- int x208,
- int x209,
- int x210,
- int x211,
- int x212,
- int x213,
- int x214,
- int x215,
- int x216,
- int x217,
- int x218,
- int x219,
- int x220,
- int x221,
- int x222,
- int x223,
- int x224,
- int x225,
- int x226,
- int x227,
- int x228,
- int x229,
- int x230,
- int x231,
- int x232,
- int x233,
- int x234,
- int x235,
- int x236,
- int x237,
- int x238,
- int x239,
- int x240,
- int x241,
- int x242,
- int x243,
- int x244,
- int x245,
- int x246,
- int x247,
- int x248,
- int x249,
- int x250,
- int x251,
- int x252,
- int x253,
- int x254,
- int x255
- ) {}
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/NumArgsTest.java Thu Jun 27 00:37:13 2013 -0400
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.api.*;
+import com.sun.tools.javac.file.*;
+import java.io.*;
+import java.util.*;
+import javax.tools.*;
+
+// More general parameter limit testing framework, and designed so
+// that it could be expanded into a general limits-testing framework
+// in the future.
+public class NumArgsTest {
+
+ private static final NumArgsTest.NestingDef[] NO_NESTING = {};
+
+ // threshold is named as such because "threshold" args is expected
+ // to pass, and "threshold" + 1 args is expected to fail.
+ private final int threshold;
+ private final boolean isStaticMethod;
+ private final String result;
+ private final String testName;
+ private final String methodName;
+ private final NestingDef[] nesting;
+ private final File testdir;
+ private final JavacTool tool = JavacTool.create();
+ private final JavacFileManager fm =
+ tool.getStandardFileManager(null, null, null);
+ private int errors = 0;
+
+ public NumArgsTest(final int threshold,
+ final boolean isStaticMethod,
+ final String result,
+ final String methodName,
+ final String testName,
+ final NestingDef[] nesting) {
+ this.threshold = threshold;
+ this.isStaticMethod = isStaticMethod;
+ this.result = result;
+ this.methodName = methodName;
+ this.testName = testName;
+ this.nesting = nesting;
+ testdir = new File(testName);
+ testdir.mkdir();
+ }
+
+ public NumArgsTest(final int threshold,
+ final boolean isStaticMethod,
+ final String result,
+ final String methodName,
+ final String testName) {
+ this(threshold, isStaticMethod, result, methodName,
+ testName, NO_NESTING);
+ }
+
+ public NumArgsTest(final int threshold,
+ final String result,
+ final String methodName,
+ final String testName,
+ final NestingDef[] nesting) {
+ this(threshold, false, result, methodName, testName, nesting);
+ }
+
+ public NumArgsTest(final int threshold,
+ final String result,
+ final String methodName,
+ final String testName) {
+ this(threshold, false, result, methodName, testName, NO_NESTING);
+ }
+
+ public NumArgsTest(final int threshold,
+ final String testName,
+ final NestingDef[] nesting) {
+ this(threshold, null, null, testName, nesting);
+ }
+
+ public NumArgsTest(final int threshold,
+ final String testName) {
+ this(threshold, null, null, testName, NO_NESTING);
+ }
+
+ public NumArgsTest(final int threshold,
+ final String testName,
+ final String constructorName,
+ final NestingDef[] nesting) {
+ this(threshold, null, constructorName, testName, nesting);
+ }
+
+ protected void writeArgs(final int num, final PrintWriter stream)
+ throws IOException {
+ stream.print("int x1");
+ for(int i = 1; i < num; i++)
+ stream.print(", int x" + (i + 1));
+ }
+
+ protected void writeMethod(final int num,
+ final String name,
+ final PrintWriter stream)
+ throws IOException {
+ stream.write("public ");
+ if (isStaticMethod) stream.write("static ");
+ if (result == null)
+ stream.write("");
+ else {
+ stream.write(result);
+ stream.write(" ");
+ }
+ stream.write(name);
+ stream.write("(");
+ writeArgs(num, stream);
+ stream.write(") {}\n");
+ }
+
+ protected void writeJavaFile(final int num,
+ final boolean pass,
+ final PrintWriter stream)
+ throws IOException {
+ final String fullName = testName + (pass ? "Pass" : "Fail");
+ stream.write("public class ");
+ stream.write(fullName);
+ stream.write(" {\n");
+ for(int i = 0; i < nesting.length; i++)
+ nesting[i].writeBefore(stream);
+ if (null == methodName)
+ writeMethod(num, fullName, stream);
+ else
+ writeMethod(num, methodName, stream);
+ for(int i = nesting.length - 1; i >= 0; i--)
+ nesting[i].writeAfter(stream);
+ stream.write("}\n");
+ }
+
+ public void runTest() throws Exception {
+ // Run the pass test
+ final String passTestName = testName + "Pass.java";
+ final StringWriter passBody = new StringWriter();
+ final PrintWriter passStream = new PrintWriter(passBody);
+ final File passFile = new File(testdir, passTestName);
+ final FileWriter passWriter = new FileWriter(passFile);
+
+ writeJavaFile(threshold, true, passStream);
+ passStream.close();
+ passWriter.write(passBody.toString());
+ passWriter.close();
+
+ final StringWriter passSW = new StringWriter();
+ final String[] passArgs = { passFile.toString() };
+ final Iterable<? extends JavaFileObject> passFiles =
+ fm.getJavaFileObjectsFromFiles(Arrays.asList(passFile));
+ final JavaCompiler.CompilationTask passTask =
+ tool.getTask(passSW, fm, null, null, null, passFiles);
+
+ if (!passTask.call()) {
+ errors++;
+ System.err.println("Compilation unexpectedly failed. Body:\n" +
+ passBody);
+ System.err.println("Output:\n" + passSW.toString());
+ }
+
+ // Run the fail test
+ final String failTestName = testName + "Fail.java";
+ final StringWriter failBody = new StringWriter();
+ final PrintWriter failStream = new PrintWriter(failBody);
+ final File failFile = new File(testdir, failTestName);
+ final FileWriter failWriter = new FileWriter(failFile);
+
+ writeJavaFile(threshold + 1, false, failStream);
+ failStream.close();
+ failWriter.write(failBody.toString());
+ failWriter.close();
+
+ final StringWriter failSW = new StringWriter();
+ final TestDiagnosticHandler failDiag =
+ new TestDiagnosticHandler("compiler.err.limit.parameters");
+ final Iterable<? extends JavaFileObject> failFiles =
+ fm.getJavaFileObjectsFromFiles(Arrays.asList(failFile));
+ final JavaCompiler.CompilationTask failTask =
+ tool.getTask(failSW,
+ tool.getStandardFileManager(null, null, null),
+ failDiag,
+ null,
+ null,
+ failFiles);
+
+ if (failTask.call()) {
+ errors++;
+ System.err.println("Compilation unexpectedly succeeded.");
+ System.err.println("Input:\n" + failBody);
+ }
+
+ if (!failDiag.sawError) {
+ errors++;
+ System.err.println("Did not see expected compile error.");
+ }
+
+ if (errors != 0)
+ throw new RuntimeException("Test failed with " +
+ errors + " errors");
+ }
+
+ public static NestingDef classNesting(final String name) {
+ return new NestedClassBuilder(name, false);
+ }
+
+ public static NestingDef classNesting(final String name,
+ final boolean isStatic) {
+ return new NestedClassBuilder(name, isStatic);
+ }
+
+ protected interface NestingDef {
+ public abstract void writeBefore(final PrintWriter stream);
+ public abstract void writeAfter(final PrintWriter stream);
+ }
+
+ private static class NestedClassBuilder implements NestingDef {
+ private final String name;
+ private final boolean isStatic;
+ public NestedClassBuilder(final String name, final boolean isStatic) {
+ this.name = name;
+ this.isStatic = isStatic;
+ }
+ public void writeBefore(final PrintWriter stream) {
+ stream.write("public ");
+ if (isStatic) stream.write("static");
+ stream.write(" class ");
+ stream.write(name);
+ stream.write(" {\n");
+ }
+ public void writeAfter(final PrintWriter stream) {
+ stream.write("}\n");
+ }
+ }
+
+ public class TestDiagnosticHandler<T> implements DiagnosticListener<T> {
+ public boolean sawError;
+ public final String target;
+
+ public TestDiagnosticHandler(final String target) {
+ this.target = target;
+ }
+
+ public void report(final Diagnostic<? extends T> diag) {
+ if (diag.getCode().equals(target))
+ sawError = true;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/StaticNestedClassConstructorArgs.java Thu Jun 27 00:37:13 2013 -0400
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8014230
+ * @summary Compiler silently generates bytecode that exceeds VM limits
+ * @compile NumArgsTest.java
+ * @run main StaticNestedClassConstructorArgs
+ */
+
+public class StaticNestedClassConstructorArgs extends NumArgsTest {
+ private static final NumArgsTest.NestingDef[] nesting = {
+ classNesting("StaticInner", true)
+ };
+
+ private StaticNestedClassConstructorArgs() {
+ super(254, "StaticNestedClassConstructorArgs", "StaticInner", nesting);
+ }
+
+ public static void main(String... args) throws Exception {
+ new StaticNestedClassConstructorArgs().runTest();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/TopLevelClassConstructorArgs.java Thu Jun 27 00:37:13 2013 -0400
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4309152
+ * @summary Compiler silently generates bytecode that exceeds VM limits
+ * @compile NumArgsTest.java
+ * @run main TopLevelClassConstructorArgs
+ */
+
+public class TopLevelClassConstructorArgs extends NumArgsTest {
+ private TopLevelClassConstructorArgs() {
+ super(254, "TopLevelClassConstructorArgs");
+ }
+
+ public static void main(String... args) throws Exception {
+ new TopLevelClassConstructorArgs().runTest();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/TopLevelClassMethodArgs.java Thu Jun 27 00:37:13 2013 -0400
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4309152
+ * @summary Compiler silently generates bytecode that exceeds VM limits
+ * @compile NumArgsTest.java
+ * @run main TopLevelClassMethodArgs
+ */
+
+public class TopLevelClassMethodArgs extends NumArgsTest {
+ private TopLevelClassMethodArgs() {
+ super(254, "void", "test", "TopLevelClassMethodArgs");
+ }
+
+ public static void main(String... args) throws Exception {
+ new TopLevelClassMethodArgs().runTest();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/limits/TopLevelClassStaticMethodArgs.java Thu Jun 27 00:37:13 2013 -0400
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4309152
+ * @summary Compiler silently generates bytecode that exceeds VM limits
+ * @compile NumArgsTest.java
+ * @run main TopLevelClassStaticMethodArgs
+ */
+
+public class TopLevelClassStaticMethodArgs extends NumArgsTest {
+ private TopLevelClassStaticMethodArgs() {
+ super(255, true, "void", "test", "TopLevelClassStaticMethodArgs");
+ }
+
+ public static void main(String... args) throws Exception {
+ new TopLevelClassStaticMethodArgs().runTest();
+ }
+}