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
attila@1092 | 1 | /* |
sundar@1482 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
attila@1092 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
sundar@1482 | 4 | * |
attila@1092 | 5 | * This code is free software; you can redistribute it and/or modify it |
attila@1092 | 6 | * under the terms of the GNU General Public License version 2 only, as |
attila@1092 | 7 | * published by the Free Software Foundation. |
sundar@1482 | 8 | * |
attila@1092 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
attila@1092 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
attila@1092 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
attila@1092 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
attila@1092 | 13 | * accompanied this code). |
sundar@1482 | 14 | * |
attila@1092 | 15 | * You should have received a copy of the GNU General Public License version |
attila@1092 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
attila@1092 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
sundar@1482 | 18 | * |
attila@1092 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
attila@1092 | 20 | * or visit www.oracle.com if you need additional information or have any |
attila@1092 | 21 | * questions. |
attila@1092 | 22 | */ |
attila@1092 | 23 | |
attila@1092 | 24 | /** |
attila@1092 | 25 | * JDK-8062799: Binary logical expressions can have numeric types |
attila@1092 | 26 | * |
attila@1092 | 27 | * @test |
attila@1092 | 28 | * @run |
attila@1092 | 29 | */ |
attila@1092 | 30 | |
attila@1092 | 31 | (function() { |
attila@1092 | 32 | var inspect = Java.type("jdk.nashorn.test.tools.StaticTypeInspector").inspect; |
attila@1092 | 33 | |
attila@1092 | 34 | var b = true; |
attila@1092 | 35 | var i = 1; |
attila@1092 | 36 | var l = 4294967296; |
attila@1092 | 37 | var d = 2.1; |
attila@1092 | 38 | var o = "foo"; |
attila@1092 | 39 | |
attila@1092 | 40 | print(inspect(b || b, "b || b")); |
attila@1092 | 41 | print(inspect(b || i, "b || i")); |
attila@1092 | 42 | print(inspect(b || l, "b || l")); |
attila@1092 | 43 | print(inspect(b || d, "b || d")); |
attila@1092 | 44 | print(inspect(b || o, "b || o")); |
attila@1092 | 45 | |
attila@1092 | 46 | print(inspect(i || b, "i || b")); |
attila@1092 | 47 | print(inspect(i || i, "i || i")); |
attila@1092 | 48 | print(inspect(i || l, "i || l")); |
attila@1092 | 49 | print(inspect(i || d, "i || d")); |
attila@1092 | 50 | print(inspect(i || o, "i || o")); |
attila@1092 | 51 | |
attila@1092 | 52 | print(inspect(l || b, "l || b")); |
attila@1092 | 53 | print(inspect(l || i, "l || i")); |
attila@1092 | 54 | print(inspect(l || l, "l || l")); |
attila@1092 | 55 | print(inspect(l || d, "l || d")); |
attila@1092 | 56 | print(inspect(l || o, "l || o")); |
attila@1092 | 57 | |
attila@1092 | 58 | print(inspect(d || b, "d || b")); |
attila@1092 | 59 | print(inspect(d || i, "d || i")); |
attila@1092 | 60 | print(inspect(d || l, "d || l")); |
attila@1092 | 61 | print(inspect(d || d, "d || d")); |
attila@1092 | 62 | print(inspect(d || o, "d || o")); |
attila@1092 | 63 | |
attila@1092 | 64 | print(inspect(o || b, "o || b")); |
attila@1092 | 65 | print(inspect(o || i, "o || i")); |
attila@1092 | 66 | print(inspect(o || l, "o || l")); |
attila@1092 | 67 | print(inspect(o || d, "o || d")); |
attila@1092 | 68 | print(inspect(o || o, "o || o")); |
attila@1092 | 69 | |
attila@1092 | 70 | print(inspect(b && b, "b && b")); |
attila@1092 | 71 | print(inspect(b && i, "b && i")); |
attila@1092 | 72 | print(inspect(b && l, "b && l")); |
attila@1092 | 73 | print(inspect(b && d, "b && d")); |
attila@1092 | 74 | print(inspect(b && o, "b && o")); |
attila@1092 | 75 | |
attila@1092 | 76 | print(inspect(i && b, "i && b")); |
attila@1092 | 77 | print(inspect(i && i, "i && i")); |
attila@1092 | 78 | print(inspect(i && l, "i && l")); |
attila@1092 | 79 | print(inspect(i && d, "i && d")); |
attila@1092 | 80 | print(inspect(i && o, "i && o")); |
attila@1092 | 81 | |
attila@1092 | 82 | print(inspect(l && b, "l && b")); |
attila@1092 | 83 | print(inspect(l && i, "l && i")); |
attila@1092 | 84 | print(inspect(l && l, "l && l")); |
attila@1092 | 85 | print(inspect(l && d, "l && d")); |
attila@1092 | 86 | print(inspect(l && o, "l && o")); |
attila@1092 | 87 | |
attila@1092 | 88 | print(inspect(d && b, "d && b")); |
attila@1092 | 89 | print(inspect(d && i, "d && i")); |
attila@1092 | 90 | print(inspect(d && l, "d && l")); |
attila@1092 | 91 | print(inspect(d && d, "d && d")); |
attila@1092 | 92 | print(inspect(d && o, "d && o")); |
attila@1092 | 93 | |
attila@1092 | 94 | print(inspect(o && b, "o && b")); |
attila@1092 | 95 | print(inspect(o && i, "o && i")); |
attila@1092 | 96 | print(inspect(o && l, "o && l")); |
attila@1092 | 97 | print(inspect(o && d, "o && d")); |
attila@1092 | 98 | print(inspect(o && o, "o && o")); |
attila@1092 | 99 | })(); |
attila@1092 | 100 | |
attila@1092 | 101 | |
attila@1092 | 102 | |
sundar@1482 | 103 |