test/tools/javac/annotations/typeAnnotations/newlocations/Lambda.java

changeset 2222
8832b6048e65
parent 1755
ddb4a2bfcd82
child 2525
2eb010b6cb22
equal deleted inserted replaced
2221:d80c3d6f4f05 2222:8832b6048e65
21 * questions. 21 * questions.
22 */ 22 */
23 23
24 /* 24 /*
25 * @test 25 * @test
26 * @bug 8008077 26 * @bug 8008077 8029721
27 * @summary new type annotation location: lambda expressions 27 * @summary new type annotation location: lambda expressions
28 * javac crash for annotated parameter type of lambda in a field
28 * @compile Lambda.java 29 * @compile Lambda.java
29 * @author Werner Dietl 30 * @author Werner Dietl
30 */ 31 */
31 32
32 import java.lang.annotation.*; 33 import java.lang.annotation.*;
55 } 56 }
56 57
57 LambdaInt2 getLambda() { 58 LambdaInt2 getLambda() {
58 return (@TA Object x, @TB Object y) -> { @TA Object l = null; System.out.println("We have: " + (@TB Object) x); }; 59 return (@TA Object x, @TB Object y) -> { @TA Object l = null; System.out.println("We have: " + (@TB Object) x); };
59 } 60 }
61
62 java.util.function.IntUnaryOperator x = (@TA int y) -> 1;
63
64 static java.util.function.IntUnaryOperator xx = (@TA int y) -> 1;
65
66 java.util.function.IntUnaryOperator foo() {
67 return (@TA int y) -> 2;
68 }
60 } 69 }
61 70
62 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 71 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
63 @interface TA { } 72 @interface TA { }
64 73

mercurial