test/tools/javac/lambda/LambdaScope05.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/LambdaScope05.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,31 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8015648
     1.7 + * @summary Duplicate variable in lambda causes javac crash
     1.8 + * @compile/fail/ref=LambdaScope05.out -XDrawDiagnostics LambdaScope05.java
     1.9 + */
    1.10 +
    1.11 +class LambdaScope05 {
    1.12 +    interface VoidFun1 {
    1.13 +        void m(int i);
    1.14 +    }
    1.15 +
    1.16 +    static Runnable r1 = () -> { VoidFun1 p = p -> { }; };
    1.17 +    Runnable r2 = () -> { VoidFun1 p = p -> { }; };
    1.18 +
    1.19 +    static {
    1.20 +        Runnable r = () -> { VoidFun1 p = p -> { }; };
    1.21 +    }
    1.22 +
    1.23 +    {
    1.24 +        Runnable r = () -> { VoidFun1 p = p -> { }; };
    1.25 +    }
    1.26 +
    1.27 +    static void m_static() {
    1.28 +        Runnable r = () -> { VoidFun1 p = p -> { }; };
    1.29 +    }
    1.30 +
    1.31 +    void m() {
    1.32 +        Runnable r = () -> { VoidFun1 p = p -> { }; };
    1.33 +    }
    1.34 +}

mercurial