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
hannesw@1369 | 1 | /* |
hannesw@1369 | 2 | * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
hannesw@1369 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
hannesw@1369 | 4 | * |
hannesw@1369 | 5 | * This code is free software; you can redistribute it and/or modify it |
hannesw@1369 | 6 | * under the terms of the GNU General Public License version 2 only, as |
hannesw@1369 | 7 | * published by the Free Software Foundation. |
hannesw@1369 | 8 | * |
hannesw@1369 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
hannesw@1369 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
hannesw@1369 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
hannesw@1369 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
hannesw@1369 | 13 | * accompanied this code). |
hannesw@1369 | 14 | * |
hannesw@1369 | 15 | * You should have received a copy of the GNU General Public License version |
hannesw@1369 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
hannesw@1369 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
hannesw@1369 | 18 | * |
hannesw@1369 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
hannesw@1369 | 20 | * or visit www.oracle.com if you need additional information or have any |
hannesw@1369 | 21 | * questions. |
hannesw@1369 | 22 | */ |
hannesw@1369 | 23 | |
hannesw@1369 | 24 | /** |
hannesw@1369 | 25 | * JDK-8073846: Javascript for-in loop returned extra keys |
hannesw@1369 | 26 | * |
hannesw@1369 | 27 | * @test |
hannesw@1369 | 28 | * @run |
hannesw@1369 | 29 | */ |
hannesw@1369 | 30 | |
hannesw@1369 | 31 | var obj = {}; |
hannesw@1369 | 32 | |
hannesw@1369 | 33 | var list = [ |
hannesw@1369 | 34 | '2100000', |
hannesw@1369 | 35 | '420000', |
hannesw@1369 | 36 | '430000' |
hannesw@1369 | 37 | ]; |
hannesw@1369 | 38 | |
hannesw@1369 | 39 | for (var i = 0; i < list.length; i++) { |
hannesw@1369 | 40 | if (obj[list[i]]) print("duplicate: " + list[i]); |
hannesw@1369 | 41 | obj[list[i]] = 'obj' + list[i] |
hannesw@1369 | 42 | } |
hannesw@1369 | 43 | |
hannesw@1369 | 44 | var count = 0; |
hannesw@1369 | 45 | for (var a in obj) { |
hannesw@1369 | 46 | count++; |
hannesw@1369 | 47 | if ('obj' + a !== obj[a]) { |
hannesw@1369 | 48 | throw 'wrong key or value: ' + a + ', ' + obj[a]; |
hannesw@1369 | 49 | } |
hannesw@1369 | 50 | } |
hannesw@1369 | 51 | |
hannesw@1369 | 52 | if (count !== 3) { |
hannesw@1369 | 53 | throw 'wrong entry count: ' + count; |
hannesw@1369 | 54 | } |