PrimitiveTypeBoxingTest.java revision 2890:e903011dafc7
1/*
2 * @test /nodynamiccopyright/
3 * @bug 8030741 8078024
4 * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800
5 * @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java
6 */
7
8public class PrimitiveTypeBoxingTest {
9
10    static void foo(long arg) {}
11    static void bar(int arg) {}
12
13    interface F<X> { void get(X arg); }
14
15    <Z> void m1(F<Z> f, Z arg) {}
16    <Z> void m2(Z arg, F<Z> f) {}
17
18    void test() {
19        m1(PrimitiveTypeBoxingTest::foo, 23); // expected: error
20        m2(23, PrimitiveTypeBoxingTest::foo); // expected: error
21
22        m1(PrimitiveTypeBoxingTest::bar, 23); // expected: success
23        m2(23, PrimitiveTypeBoxingTest::bar); // expected: success
24    }
25}
26