test/tools/javac/lambda/MethodHandleInvokeTest.java

Mon, 01 Jun 2015 15:19:54 -0700

author
darcy
date
Mon, 01 Jun 2015 15:19:54 -0700
changeset 3834
45746e46893b
parent 3075
745c9feb99f2
permissions
-rw-r--r--

8075546: Add tiered testing definitions to the langtools repo
Reviewed-by: jjg

mcimadamore@3075 1 /*
mcimadamore@3075 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
mcimadamore@3075 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@3075 4 *
mcimadamore@3075 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@3075 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@3075 7 * published by the Free Software Foundation.
mcimadamore@3075 8 *
mcimadamore@3075 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@3075 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@3075 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@3075 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@3075 13 * accompanied this code).
mcimadamore@3075 14 *
mcimadamore@3075 15 * You should have received a copy of the GNU General Public License version
mcimadamore@3075 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@3075 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@3075 18 *
mcimadamore@3075 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
mcimadamore@3075 20 * or visit www.oracle.com if you need additional information or have any
mcimadamore@3075 21 * questions.
mcimadamore@3075 22 */
mcimadamore@3075 23
mcimadamore@3075 24 /*
mcimadamore@3075 25 * @test
mcimadamore@3075 26 * @bug 8130506 8147530
mcimadamore@3075 27 * @summary javac AssertionError when invoking MethodHandle.invoke with lambda parameter
mcimadamore@3075 28 * @run main MethodHandleInvokeTest
mcimadamore@3075 29 */
mcimadamore@3075 30
mcimadamore@3075 31 import java.lang.invoke.MethodHandle;
mcimadamore@3075 32
mcimadamore@3075 33 public class MethodHandleInvokeTest {
mcimadamore@3075 34
mcimadamore@3075 35 private static interface Obj2Obj {
mcimadamore@3075 36 Object run(Object obj) throws Throwable;
mcimadamore@3075 37 }
mcimadamore@3075 38
mcimadamore@3075 39 private static void m(Obj2Obj param) {
mcimadamore@3075 40 }
mcimadamore@3075 41
mcimadamore@3075 42 public static void main(String[] args) {
mcimadamore@3075 43 m((obj) -> {
mcimadamore@3075 44 MethodHandle mhandle = null;
mcimadamore@3075 45 mhandle.invoke(obj);
mcimadamore@3075 46 return null;
mcimadamore@3075 47 });
mcimadamore@3075 48 }
mcimadamore@3075 49 }

mercurial