test/tools/javac/lambda/MostSpecific12.java

Mon, 23 Jun 2014 13:14:32 -0700

author
rfield
date
Mon, 23 Jun 2014 13:14:32 -0700
changeset 2528
eb284abd64fe
parent 0
959103a6100f
permissions
-rw-r--r--

8046060: Different results of floating point multiplication for lambda code block
Summary: propogate strictfp into lambda body
Reviewed-by: vromero, jlahoda

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8034223
     4  * @summary Most-specific testing with inference variables in function parameter types
     5  * @compile/fail/ref=MostSpecific12.out -XDrawDiagnostics MostSpecific12.java
     6  */
     7 class MostSpecific12 {
     9     interface I<T> { void take(T arg1, String arg2); }
    10     interface J<T> { void take(String arg1, T arg2); }
    11     interface K { void take(String arg1, String arg2); }
    13     <T> void m1(I<T> arg) {}
    14     void m1(K arg) {}
    16     <T> void m2(J<T> arg) {}
    17     <T> void m2(K arg) {}
    19     <T> void m3(I<T> arg) {}
    20     <T> void m3(J<T> arg) {}
    22     void test() {
    23         m1((String s1, String s2) -> {}); // ok
    24         m2((String s1, String s2) -> {}); // ok
    25         m3((String s1, String s2) -> {}); // error
    27         m1(this::referencedMethod); // ok
    28         m2(this::referencedMethod); // ok
    29         m3(this::referencedMethod); // error
    31         m1(String::compareTo); // ok
    32         m2(String::compareTo); // ok
    33         m3(String::compareTo); // error
    34     }
    36     void referencedMethod(String s1, String s2) {}
    38 }

mercurial