test/langtools/tools/javac/var_implicit_lambda/VarInImplicitLambdaNegTest01.java
changeset 48935 03ae177c26b0
child 49152 e38b6a7f65ee
equal deleted inserted replaced
48934:3390b463d7a2 48935:03ae177c26b0
       
     1 /*
       
     2  * @test /nodynamiccopyright/
       
     3  * @bug 8198512
       
     4  * @summary compiler support for local-variable syntax for lambda parameters
       
     5  * @compile/fail/ref=VarInImplicitLambdaNegTest01.out -XDrawDiagnostics VarInImplicitLambdaNegTest01.java
       
     6  */
       
     7 
       
     8 import java.util.function.*;
       
     9 
       
    10 class VarInImplicitLambdaNegTest01 {
       
    11     IntBinaryOperator f1 = (x, var y) -> x + y;                              // error implicit and var
       
    12     IntBinaryOperator f2 = (var x, y) -> x + y;                              // error var and implicit
       
    13     IntBinaryOperator f3 = (int x, var y) -> x + y;                          // error var and explicit
       
    14     IntBinaryOperator f4 = (int x, y) -> x + y;                              // error explicit and implicit
       
    15 
       
    16     BiFunction<String[], String, String> f5 = (var s1[], var s2) -> s2;      // error var and array
       
    17     BiFunction<Function<String, String>, String, String> f = (Function<String, String> s1, String s2) -> s2; // ok
       
    18 }