equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * @test /nodynamiccopyright/ |
2 * @test /nodynamiccopyright/ |
3 * @bug 8198512 |
3 * @bug 8198512 8199327 |
4 * @summary compiler support for local-variable syntax for lambda parameters |
4 * @summary compiler support for local-variable syntax for lambda parameters |
5 * @compile/fail/ref=VarInImplicitLambdaNegTest01.out -XDrawDiagnostics VarInImplicitLambdaNegTest01.java |
5 * @compile/fail/ref=VarInImplicitLambdaNegTest01.out -XDrawDiagnostics VarInImplicitLambdaNegTest01.java |
6 */ |
6 */ |
7 |
7 |
8 import java.util.function.*; |
8 import java.util.function.*; |
12 IntBinaryOperator f2 = (var x, y) -> x + y; // error var and implicit |
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 |
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 |
14 IntBinaryOperator f4 = (int x, y) -> x + y; // error explicit and implicit |
15 |
15 |
16 BiFunction<String[], String, String> f5 = (var s1[], var s2) -> s2; // error var and array |
16 BiFunction<String[], String, String> f5 = (var s1[], var s2) -> s2; // error var and array |
|
17 |
|
18 // correct use |
|
19 IntBinaryOperator f6 = (var x, var y) -> x + y; // ok |
17 BiFunction<Function<String, String>, String, String> f = (Function<String, String> s1, String s2) -> s2; // ok |
20 BiFunction<Function<String, String>, String, String> f = (Function<String, String> s1, String s2) -> s2; // ok |
18 } |
21 } |