test/langtools/tools/javac/var_implicit_lambda/VarInImplicitLambdaNegTest01.java
author vromero
Thu, 22 Feb 2018 15:49:32 -0500
changeset 48935 03ae177c26b0
child 49152 e38b6a7f65ee
permissions -rw-r--r--
8198512: compiler support for local-variable syntax for lambda parameters Reviewed-by: mcimadamore

/*
 * @test /nodynamiccopyright/
 * @bug 8198512
 * @summary compiler support for local-variable syntax for lambda parameters
 * @compile/fail/ref=VarInImplicitLambdaNegTest01.out -XDrawDiagnostics VarInImplicitLambdaNegTest01.java
 */

import java.util.function.*;

class VarInImplicitLambdaNegTest01 {
    IntBinaryOperator f1 = (x, var y) -> x + y;                              // error implicit and var
    IntBinaryOperator f2 = (var x, y) -> x + y;                              // error var and implicit
    IntBinaryOperator f3 = (int x, var y) -> x + y;                          // error var and explicit
    IntBinaryOperator f4 = (int x, y) -> x + y;                              // error explicit and implicit

    BiFunction<String[], String, String> f5 = (var s1[], var s2) -> s2;      // error var and array
    BiFunction<Function<String, String>, String, String> f = (Function<String, String> s1, String s2) -> s2; // ok
}