test/tools/javac/lambda/LambdaExpr10.java

Thu, 30 Jan 2014 11:09:01 -0800

author
sogoel
date
Thu, 30 Jan 2014 11:09:01 -0800
changeset 2255
b2e4c5ca111f
parent 0
959103a6100f
permissions
-rw-r--r--

8027175: Existing regression tests in tl/langtools and tl/jdk need to be updated for @bug keyword
Reviewed-by: jjg, ksrini
Contributed-by: matherey.nunez@oracle.com

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8003280
     4  * @summary Add lambda tests
     5  *  check that lambda in array initializers (with wrong type) are correctly rejected
     6  * @compile/fail/ref=LambdaExpr10.out -XDrawDiagnostics LambdaExpr10.java
     7  */
     9 class LambdaExpr10 {
    11     interface Block<T> {
    12        void m(T t);
    13     }
    15     void apply(Object[] obj_arr) { }
    17     void test1() {
    18         Object[] arr1 =  { t -> { } };
    19         Object[][] arr2 =  { { t -> { } } };
    20     }
    22     void test2() {
    23         Object[] arr1 =  new Object[]{ t -> { } };
    24         Object[][] arr2 =  new Object[][]{ { t -> { } } };
    25     }
    27     void test3() {
    28         apply(new Object[]{ t -> { } });
    29         apply(new Object[][]{ { t -> { } } });
    30     }
    32     void test4() {
    33         Block<?>[] arr1 =  { t -> t };
    34         Block<?>[] arr2 =  new Block<?>[]{ t -> t };
    35         apply(new Block<?>[]{ t -> { }, t -> { } });
    36     }
    37 }

mercurial