Tue, 01 Sep 2015 18:28:11 +0530
8068901: Surprising behavior with more than one functional interface on a class
8068903: Can't invoke vararg @FunctionalInterface methods
Reviewed-by: attila, hannesw
sundar@538 | 1 | /* |
sundar@538 | 2 | * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
sundar@538 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
attila@962 | 4 | * |
sundar@538 | 5 | * This code is free software; you can redistribute it and/or modify it |
sundar@538 | 6 | * under the terms of the GNU General Public License version 2 only, as |
sundar@538 | 7 | * published by the Free Software Foundation. |
attila@962 | 8 | * |
sundar@538 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
sundar@538 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
sundar@538 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
sundar@538 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
sundar@538 | 13 | * accompanied this code). |
attila@962 | 14 | * |
sundar@538 | 15 | * You should have received a copy of the GNU General Public License version |
sundar@538 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
sundar@538 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
attila@962 | 18 | * |
sundar@538 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
sundar@538 | 20 | * or visit www.oracle.com if you need additional information or have any |
sundar@538 | 21 | * questions. |
sundar@538 | 22 | */ |
sundar@538 | 23 | |
sundar@538 | 24 | /** |
sundar@538 | 25 | * JDK-8024174: Setting __proto__ property in Object literal should be supported * |
sundar@538 | 26 | * @test |
sundar@538 | 27 | * @run |
sundar@538 | 28 | */ |
sundar@538 | 29 | |
sundar@538 | 30 | var p = { foo: function() { print("p.foo"); } }; |
sundar@538 | 31 | |
sundar@538 | 32 | var obj = { |
sundar@538 | 33 | __proto__ : p, |
sundar@538 | 34 | bar: 44 |
sundar@538 | 35 | }; |
sundar@538 | 36 | |
sundar@538 | 37 | if (obj.__proto__ !== p || Object.getPrototypeOf(obj) !== p) { |
sundar@538 | 38 | fail("obj.__proto__ was not set inside literal"); |
sundar@538 | 39 | } |
sundar@538 | 40 | |
sundar@538 | 41 | if (typeof(obj.foo) !== 'function' || obj.foo !== p.foo) { |
sundar@538 | 42 | fail("'obj' failed to inherit 'foo' from 'p'"); |
sundar@538 | 43 | } |
sundar@538 | 44 | |
sundar@538 | 45 | var obj2 = { |
sundar@538 | 46 | __proto__: null |
sundar@538 | 47 | }; |
sundar@538 | 48 | |
sundar@847 | 49 | if (Object.getPrototypeOf(obj2) !== null) { |
sundar@538 | 50 | fail("obj2.__proto__ was not set to null inside literal"); |
sundar@538 | 51 | } |