Anon.java revision 553
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne/*
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e217869edbae075c18fd85c2d468a7ce9050b3b3Jake Feasel *
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * This code is free software; you can redistribute it and/or modify it
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * under the terms of the GNU General Public License version 2 only, as
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * published by the Free Software Foundation.
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne *
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * This code is distributed in the hope that it will be useful, but WITHOUT
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * version 2 for more details (a copy is included in the LICENSE file that
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * accompanied this code).
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne *
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * You should have received a copy of the GNU General Public License version
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * 2 along with this work; if not, write to the Free Software Foundation,
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne *
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * or visit www.oracle.com if you need additional information or have any
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * questions.
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne */
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne/*
e26e5073e1266868172d72453c97f413fe2fb603Jake Feasel * @test
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * @bug 4986231
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne * @summary varargs versus anonymous constructors crashes javac
3c3d2165b8fd5cb73ae09a5c515512718ad145ddJake Feasel * @author gafter
3c3d2165b8fd5cb73ae09a5c515512718ad145ddJake Feasel *
3c3d2165b8fd5cb73ae09a5c515512718ad145ddJake Feasel * @compile Anon.java
3c3d2165b8fd5cb73ae09a5c515512718ad145ddJake Feasel */
3c3d2165b8fd5cb73ae09a5c515512718ad145ddJake Feasel
3c3d2165b8fd5cb73ae09a5c515512718ad145ddJake Feaselclass Anon {
3c3d2165b8fd5cb73ae09a5c515512718ad145ddJake Feasel Anon() {
3c3d2165b8fd5cb73ae09a5c515512718ad145ddJake Feasel Fox fox1 = new Fox(1) {};
3c3d2165b8fd5cb73ae09a5c515512718ad145ddJake Feasel Fox fox2 = new Fox(new String[] { "hello" }) {};
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne Fox fox3 = new Fox(null) {};
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne Fox fox4 = new Fox() {};
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne Fox fox5 = new Fox("hello") {};
40cf8018f65835fdf706efcbf62e9a3a06cb3179Jake Feasel Fox fox6 = new Fox("hello", "bye") {};
ea4b5953a78d3812cef59dcb7a3067575c1e9b82Jake Feasel }
ea4b5953a78d3812cef59dcb7a3067575c1e9b82Jake Feasel}
ea4b5953a78d3812cef59dcb7a3067575c1e9b82Jake Feasel
ea4b5953a78d3812cef59dcb7a3067575c1e9b82Jake Feaselclass Fox {
ea4b5953a78d3812cef59dcb7a3067575c1e9b82Jake Feasel Fox(int a) {
196243e2d9af9c8b48718d490e56c9816538b4c2Huck _keys = new String[0];
26a6ec53bb06b3fb881e2a0cf5855c300513cad6Jake Feasel }
26a6ec53bb06b3fb881e2a0cf5855c300513cad6Jake Feasel
26a6ec53bb06b3fb881e2a0cf5855c300513cad6Jake Feasel Fox(String... keys) {
26a6ec53bb06b3fb881e2a0cf5855c300513cad6Jake Feasel _keys = keys;
e217869edbae075c18fd85c2d468a7ce9050b3b3Jake Feasel }
26a6ec53bb06b3fb881e2a0cf5855c300513cad6Jake Feasel
0c69f7dcc39578744f9b3bdf86148d1ad7fb2117Elizabeth final String[] _keys;
48ddd46e9e22ee57a7fb400c6296f977c11173b3Elizabeth Browne
d5b7485f164e9584d8b84bd882cb8df10c61bfa9Elizabeth Browne}
da94b90a76ad985d8b442a0571f96a2cf8e1d551Elizabeth Browne