test/tools/javac/lambda/EffectivelyFinal01.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/EffectivelyFinal01.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,18 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8003280
     1.7 + * @summary Add lambda tests
     1.8 + *  effectively final check fails on method parameter
     1.9 + * @compile/fail/ref=EffectivelyFinal01.out -XDrawDiagnostics EffectivelyFinal01.java
    1.10 + */
    1.11 +class EffectivelyFinal01 {
    1.12 +
    1.13 +    interface SAM {
    1.14 +        Integer m(Integer i);
    1.15 +    }
    1.16 +
    1.17 +    void test(Integer nefPar) {
    1.18 +        SAM s = (Integer h) ->  { Integer k = 0; return k + h + nefPar; };
    1.19 +        nefPar++;  //non-effectively final
    1.20 +    }
    1.21 +}

mercurial