test/tools/javac/lambda/MethodReference52.java

Thu, 21 Feb 2013 15:27:05 +0000

author
mcimadamore
date
Thu, 21 Feb 2013 15:27:05 +0000
changeset 1600
3fef0cae83b3
parent 0
959103a6100f
permissions
-rw-r--r--

8008444: Inherited generic functional descriptors are merged incorrectly
Summary: Missing call to Types.createMethodWithThrownTypes
Reviewed-by: jjg

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8003280
     4  * @summary Add lambda tests
     5  *  special cases of method references (getClass()/Array.clone()) not handled properly
     6  * @compile/fail/ref=MethodReference52.out -XDrawDiagnostics MethodReference52.java
     7  */
     8 import java.util.*;
    10 class MethodReference52 {
    12     interface Clone1 {
    13         int[] m();
    14     }
    16     interface Clone2 {
    17         Object m();
    18     }
    20     interface WrongClone {
    21         long[] m();
    22     }
    24     interface GetClass {
    25         Class<? extends List> m();
    26     }
    28     interface WrongGetClass {
    29         Class<List<String>> m();
    30     }
    32     void test(int[] iarr, List<String> ls) {
    33         Clone1 c1 = iarr::clone; //ok
    34         Clone2 c2 = iarr::clone; //ok - type more generic
    35         WrongClone c3 = iarr::clone; //bad return type
    36         GetClass c4 = ls::getClass; //ok
    37         WrongGetClass c5 = ls::getClass; //bad return type
    38     }
    39 }

mercurial