langtools/test/tools/javac/lambda/self_initializer/T8053906/SelfInitializerInLambdaTestc.java
changeset 32164 6c65d5b414bc
equal deleted inserted replaced
32163:2bdcabf14e91 32164:6c65d5b414bc
       
     1 /*
       
     2  * @test /nodynamiccopyright/
       
     3  * @bug 8053906
       
     4  * @summary javac, some lambda programs are rejected by flow analysis
       
     5  * @compile/fail/ref=SelfInitializerInLambdaTestc.out -XDrawDiagnostics SelfInitializerInLambdaTestc.java
       
     6  */
       
     7 
       
     8 public class SelfInitializerInLambdaTestc {
       
     9     interface SAM {
       
    10         void foo();
       
    11     }
       
    12 
       
    13     final SAM notInitialized = ()-> {
       
    14         SAM simpleVariable = () -> notInitialized.foo();
       
    15     };
       
    16 
       
    17     final SAM notInitialized2 = ()-> {
       
    18         SAM simpleVariable1 = () -> {
       
    19             SAM simpleVariable2 = () -> {
       
    20                 SAM simpleVariable3 = () -> {
       
    21                     SAM simpleVariable4 = () -> notInitialized2.foo();
       
    22                 };
       
    23             };
       
    24         };
       
    25     };
       
    26 }