< prev index next >

test/langtools/tools/javac/lambda/self_initializer/T8024809/SelfInitializerInLambdaTesta.java

Print this page

 1 /*
 2  * @test /nodynamiccopyright/
 3  * @bug 8024809
 4  * @summary javac, some lambda programs are rejected by flow analysis
 5  * @compile/fail/ref=SelfInitializerInLambdaTesta.out -XDrawDiagnostics SelfInitializerInLambdaTesta.java
 6  */
 7 
 8 public class SelfInitializerInLambdaTesta {
 9 
10     final Runnable r1 = ()->System.out.println(r1);
11 
12     final Object lock = new Object();
13 
14     final Runnable r2 = ()->{
15         System.out.println(r2);
16         synchronized (lock){}
17     };
18 
19     final Runnable r3 = ()->{
20         synchronized (lock){
21             System.out.println(r3);
22         }
23     };
24 
25     final Runnable r4 = ()->{
26         System.out.println(r4);
27     };
28 
29     interface SAM {
30         int m(String s);
31     }
32 

 1 /*
 2  * @test /nodynamiccopyright/
 3  * @bug 8024809
 4  * @summary javac, some lambda programs are rejected by flow analysis
 5  * @compile/fail/ref=SelfInitializerInLambdaTesta.out -XDrawDiagnostics SelfInitializerInLambdaTesta.java
 6  */
 7 
 8 public class SelfInitializerInLambdaTesta {
 9 
10     final Runnable r1 = ()->System.out.println(r1);
11 
12     final Object lock = new Object() {};
13 
14     final Runnable r2 = ()->{
15         System.out.println(r2);
16         synchronized (lock){}
17     };
18 
19     final Runnable r3 = ()->{
20         synchronized (lock){
21             System.out.println(r3);
22         }
23     };
24 
25     final Runnable r4 = ()->{
26         System.out.println(r4);
27     };
28 
29     interface SAM {
30         int m(String s);
31     }
32 
< prev index next >