test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java

changeset 2402
b45fd486977d
parent 2382
14979dd5e034
equal deleted inserted replaced
2397:d1005694e384 2402:b45fd486977d
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8030741
4 * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800
5 * @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java
6 */
7
8 public 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 }

mercurial