mcimadamore@1415: /* mcimadamore@1415: * @test /nodynamiccopyright/ mcimadamore@1415: * @bug 8003280 mcimadamore@1415: * @summary Add lambda tests mcimadamore@1415: * Missing cast to SAM type that causes type inference to not work. mcimadamore@1415: * @compile/fail/ref=InferenceTest_neg5.out -XDrawDiagnostics InferenceTest_neg5.java mcimadamore@1415: */ mcimadamore@1415: mcimadamore@1415: import java.util.*; mcimadamore@1415: mcimadamore@1415: public class InferenceTest_neg5 { mcimadamore@1415: public static void main(String[] args) { mcimadamore@1415: InferenceTest_neg5 test = new InferenceTest_neg5(); mcimadamore@1415: test.method1(n -> {}); mcimadamore@1415: test.method1((SAM1)n -> {}); mcimadamore@1415: test.method1((SAM1)n -> {n++;}); mcimadamore@1415: test.method1((SAM1>)n -> {List list = Arrays.asList("string1", "string2"); Collections.sort(list,n);}); mcimadamore@1415: test.method1((SAM1)n -> {n.start();}); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface SAM1 { mcimadamore@1415: void m1(X arg); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: void method1(SAM1 s) {} mcimadamore@1415: }