Thu, 10 Oct 2013 14:58:04 +0200
8001931: The new build system whitespace cleanup
Reviewed-by: tbell, simonis, erikj
jrose@267 | 1 | /* |
mcimadamore@674 | 2 | * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
jrose@267 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jrose@267 | 4 | * |
jrose@267 | 5 | * This code is free software; you can redistribute it and/or modify it |
jrose@267 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jrose@267 | 7 | * published by the Free Software Foundation. |
jrose@267 | 8 | * |
jrose@267 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jrose@267 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jrose@267 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jrose@267 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jrose@267 | 13 | * accompanied this code). |
jrose@267 | 14 | * |
jrose@267 | 15 | * You should have received a copy of the GNU General Public License version |
jrose@267 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jrose@267 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jrose@267 | 18 | * |
ohair@554 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 20 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 21 | * questions. |
jrose@267 | 22 | */ |
jrose@267 | 23 | |
jrose@267 | 24 | /* |
jrose@267 | 25 | * @test |
mcimadamore@674 | 26 | * @bug 6754038 6979327 |
jrose@267 | 27 | * @summary Generate call sites for method handle |
jrose@267 | 28 | * @author jrose |
jrose@267 | 29 | * |
mcimadamore@674 | 30 | * @compile -source 7 -target 7 -XDallowTransitionalJSR292=no InvokeMH.java |
jrose@267 | 31 | */ |
jrose@267 | 32 | |
jrose@267 | 33 | /* |
jrose@267 | 34 | * Standalone testing: |
jrose@267 | 35 | * <code> |
jrose@267 | 36 | * $ cd $MY_REPO_DIR/langtools |
jrose@267 | 37 | * $ (cd make; make) |
jrose@267 | 38 | * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/meth/InvokeMH.java |
jrose@267 | 39 | * $ javap -c -classpath dist meth.InvokeMH |
jrose@267 | 40 | * </code> |
jrose@267 | 41 | */ |
jrose@267 | 42 | |
jrose@267 | 43 | package meth; |
jrose@267 | 44 | |
ksrini@957 | 45 | import java.lang.invoke.MethodHandle; |
jrose@267 | 46 | |
jrose@267 | 47 | public class InvokeMH { |
jrose@267 | 48 | void test(MethodHandle mh_SiO, |
jrose@267 | 49 | MethodHandle mh_vS, |
jrose@267 | 50 | MethodHandle mh_vi, |
jrose@571 | 51 | MethodHandle mh_vv) throws Throwable { |
jrose@267 | 52 | Object o; String s; int i; // for return type testing |
jrose@267 | 53 | |
jrose@267 | 54 | // next five must have sig = (String,int)Object |
jrose@571 | 55 | mh_SiO.invokeExact("world", 123); |
jrose@571 | 56 | mh_SiO.invokeExact("mundus", 456); |
jrose@267 | 57 | Object k = "kosmos"; |
jrose@571 | 58 | mh_SiO.invokeExact((String)k, 789); |
jrose@571 | 59 | o = mh_SiO.invokeExact((String)null, 000); |
mcimadamore@674 | 60 | o = (Object) mh_SiO.invokeExact("arda", -123); |
jrose@267 | 61 | |
jrose@267 | 62 | // sig = ()String |
mcimadamore@674 | 63 | s = (String) mh_vS.invokeExact(); |
jrose@267 | 64 | |
jrose@267 | 65 | // sig = ()int |
mcimadamore@674 | 66 | i = (int) mh_vi.invokeExact(); |
mcimadamore@674 | 67 | o = (int) mh_vi.invokeExact(); |
jrose@267 | 68 | |
jrose@267 | 69 | // sig = ()void |
mcimadamore@674 | 70 | mh_vv.invokeExact(); |
jrose@571 | 71 | } |
jrose@571 | 72 | |
jrose@571 | 73 | void testGen(MethodHandle mh_SiO, |
jrose@571 | 74 | MethodHandle mh_vS, |
jrose@571 | 75 | MethodHandle mh_vi, |
jrose@571 | 76 | MethodHandle mh_vv) throws Throwable { |
jrose@571 | 77 | Object o; String s; int i; // for return type testing |
jrose@571 | 78 | |
jrose@571 | 79 | // next five must have sig = (*,*)* |
jjh@1021 | 80 | o = mh_SiO.invoke((Object)"world", (Object)123); |
jjh@1021 | 81 | mh_SiO.invoke((Object)"mundus", (Object)456); |
jrose@571 | 82 | Object k = "kosmos"; |
jjh@1021 | 83 | o = mh_SiO.invoke(k, 789); |
jjh@1021 | 84 | o = mh_SiO.invoke(null, 000); |
jjh@1021 | 85 | o = mh_SiO.invoke("arda", -123); |
jrose@571 | 86 | |
jrose@571 | 87 | // sig = ()String |
jjh@1021 | 88 | o = mh_vS.invoke(); |
jrose@571 | 89 | |
jrose@571 | 90 | // sig = ()int |
jjh@1021 | 91 | i = (int) mh_vi.invoke(); |
jjh@1021 | 92 | o = (int) mh_vi.invoke(); |
jjh@1021 | 93 | mh_vi.invoke(); |
jrose@571 | 94 | |
jrose@571 | 95 | // sig = ()void |
jjh@1021 | 96 | mh_vv.invoke(); |
jjh@1021 | 97 | o = mh_vv.invoke(); |
jrose@267 | 98 | } |
jrose@267 | 99 | } |