langtools/test/tools/javac/lambda/EffectivelyFinal01.java
author mcimadamore
Wed, 26 Oct 2016 15:41:25 +0100
changeset 41856 13a056e8f16e
parent 14547 86d8d242b0c4
permissions -rw-r--r--
8168774: Polymorhic signature method check crashes javac Summary: Check for polysig method assumes arity is greater than zero Reviewed-by: vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     1
/*
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     3
 * @bug 8003280
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     4
 * @summary Add lambda tests
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     5
 *  effectively final check fails on method parameter
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     6
 * @compile/fail/ref=EffectivelyFinal01.out -XDrawDiagnostics EffectivelyFinal01.java
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     7
 */
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     8
class EffectivelyFinal01 {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     9
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    10
    interface SAM {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    11
        Integer m(Integer i);
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    12
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    13
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    14
    void test(Integer nefPar) {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    15
        SAM s = (Integer h) ->  { Integer k = 0; return k + h + nefPar; };
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    16
        nefPar++;  //non-effectively final
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    17
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    18
}