test/tools/javac/flow/T8042741/LambdaArgumentsTest.java

Tue, 09 Sep 2014 12:16:25 -0400

author
pgovereau
date
Tue, 09 Sep 2014 12:16:25 -0400
changeset 2591
fc1b69dce787
permissions
-rw-r--r--

8054210: NullPointerException when compiling specific code.
Reviewed-by: vromero, jlahoda

pgovereau@2591 1 /*
pgovereau@2591 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
pgovereau@2591 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
pgovereau@2591 4 *
pgovereau@2591 5 * This code is free software; you can redistribute it and/or modify it
pgovereau@2591 6 * under the terms of the GNU General Public License version 2 only, as
pgovereau@2591 7 * published by the Free Software Foundation.
pgovereau@2591 8 *
pgovereau@2591 9 * This code is distributed in the hope that it will be useful, but WITHOUT
pgovereau@2591 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
pgovereau@2591 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
pgovereau@2591 12 * version 2 for more details (a copy is included in the LICENSE file that
pgovereau@2591 13 * accompanied this code).
pgovereau@2591 14 *
pgovereau@2591 15 * You should have received a copy of the GNU General Public License version
pgovereau@2591 16 * 2 along with this work; if not, write to the Free Software Foundation,
pgovereau@2591 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
pgovereau@2591 18 *
pgovereau@2591 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
pgovereau@2591 20 * or visit www.oracle.com if you need additional information or have any
pgovereau@2591 21 * questions.
pgovereau@2591 22 */
pgovereau@2591 23
pgovereau@2591 24 /* @test
pgovereau@2591 25 * @bug 8054210
pgovereau@2591 26 * @summary NullPointerException when compiling specific code
pgovereau@2591 27 * @compile LambdaArgumentsTest.java
pgovereau@2591 28 */
pgovereau@2591 29
pgovereau@2591 30 public class LambdaArgumentsTest {
pgovereau@2591 31 interface Thrower<E extends Exception> { void apply() throws E; }
pgovereau@2591 32 interface Consumer<E> { void take(E arg); }
pgovereau@2591 33
pgovereau@2591 34 <E extends Exception>
pgovereau@2591 35 void m1(Thrower<E> a1, Consumer<E> a2) {}
pgovereau@2591 36
pgovereau@2591 37 <E extends Exception>
pgovereau@2591 38 void m2(Thrower<E> a1, Consumer<RuntimeException> a2) {}
pgovereau@2591 39
pgovereau@2591 40 void test() {
pgovereau@2591 41 m1(() -> {}, e -> {});
pgovereau@2591 42 m2(() -> {}, (RuntimeException e) -> {});
pgovereau@2591 43 }
pgovereau@2591 44 }

mercurial