jrose@267: /* jrose@267: * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. jrose@267: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jrose@267: * jrose@267: * This code is free software; you can redistribute it and/or modify it jrose@267: * under the terms of the GNU General Public License version 2 only, as jrose@267: * published by the Free Software Foundation. jrose@267: * jrose@267: * This code is distributed in the hope that it will be useful, but WITHOUT jrose@267: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jrose@267: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jrose@267: * version 2 for more details (a copy is included in the LICENSE file that jrose@267: * accompanied this code). jrose@267: * jrose@267: * You should have received a copy of the GNU General Public License version jrose@267: * 2 along with this work; if not, write to the Free Software Foundation, jrose@267: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jrose@267: * jrose@267: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, jrose@267: * CA 95054 USA or visit www.sun.com if you need additional information or jrose@267: * have any questions. jrose@267: */ jrose@267: jrose@267: /* jrose@267: * @test jrose@267: * @bug 6754038 jrose@267: * @summary Generate call sites for method handle jrose@267: * @author jrose jrose@267: * jrose@267: * @compile -source 7 -target 7 InvokeMH.java jrose@267: */ jrose@267: jrose@267: /* jrose@267: * Standalone testing: jrose@267: * jrose@267: * $ cd $MY_REPO_DIR/langtools jrose@267: * $ (cd make; make) jrose@267: * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/meth/InvokeMH.java jrose@267: * $ javap -c -classpath dist meth.InvokeMH jrose@267: * jrose@267: */ jrose@267: jrose@267: package meth; jrose@267: jrose@267: import java.dyn.MethodHandle; jrose@267: jrose@267: public class InvokeMH { jrose@267: void test(MethodHandle mh_SiO, jrose@267: MethodHandle mh_vS, jrose@267: MethodHandle mh_vi, jrose@267: MethodHandle mh_vv) { jrose@267: Object o; String s; int i; // for return type testing jrose@267: jrose@267: // next five must have sig = (String,int)Object jrose@267: mh_SiO.invoke("world", 123); jrose@267: mh_SiO.invoke("mundus", 456); jrose@267: Object k = "kosmos"; jrose@267: mh_SiO.invoke((String)k, 789); jrose@267: o = mh_SiO.invoke((String)null, 000); jrose@267: o = mh_SiO.invoke("arda", -123); jrose@267: jrose@267: // sig = ()String jrose@267: s = mh_vS.invoke(); jrose@267: jrose@267: // sig = ()int jrose@267: i = mh_vi.invoke(); jrose@267: o = mh_vi.invoke(); jrose@267: //s = mh_vi.invoke(); //BAD jrose@267: mh_vi.invoke(); jrose@267: jrose@267: // sig = ()void jrose@267: //o = mh_vv.invoke(); //BAD jrose@267: mh_vv.invoke(); jrose@267: } jrose@267: }