JDK-8129410.js revision 1329:1b4ad06c714e
1231200Smm/*
2231200Smm * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
3231200Smm * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4231200Smm *
5231200Smm * This code is free software; you can redistribute it and/or modify it
6231200Smm * under the terms of the GNU General Public License version 2 only, as
7231200Smm * published by the Free Software Foundation.
8231200Smm *
9231200Smm * This code is distributed in the hope that it will be useful, but WITHOUT
10231200Smm * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11231200Smm * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12231200Smm * version 2 for more details (a copy is included in the LICENSE file that
13231200Smm * accompanied this code).
14231200Smm *
15231200Smm * You should have received a copy of the GNU General Public License version
16231200Smm * 2 along with this work; if not, write to the Free Software Foundation,
17231200Smm * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18231200Smm *
19231200Smm * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20231200Smm * or visit www.oracle.com if you need additional information or have any
21231200Smm * questions.
22231200Smm */
23231200Smm
24231200Smm/**
25238856Smm * JDK-8129410: Java adapters with class-level overrides should preserve variable arity constructors
26231200Smm *
27238856Smm * @test
28231200Smm * @run
29231200Smm */
30231200Smm
31231200Smmvar VarArgConstructor = Java.type("jdk.nashorn.test.models.VarArgConstructor");
32231200Smmvar VarArgConstructorExtended = Java.extend(VarArgConstructor, {});
33231200Smm
34231200Smm// If the fix didn't work we wouldn't even get past the constructor invocation
35231200Smm// as it'd complain there's no matching arity constructor.
36231200Smmvar newExtended = new VarArgConstructorExtended(1, true, "a", "b");
37231200Smm
38231200Smm// Assert the expected constructor was invoked.
39231200SmmAssert.assertEquals("vararg", newExtended.indicator);
40315433Smm