view test/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java @ 3916:cd6eb36db1bb jdk8u292-b05 jdk8u302-b00

8078024: javac, several incorporation steps are silently failing when an error should be reported Reviewed-by: phh, andrew
author peterz
date Wed, 22 Apr 2015 09:44:15 -0700
parents 8ee530e741d1
children
line wrap: on
line source

/*
 * @test /nodynamiccopyright/
 * @bug 8030741 8078024
 * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800
 * @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java
 */

public class PrimitiveTypeBoxingTest {

    static void foo(long arg) {}
    static void bar(int arg) {}

    interface F<X> { void get(X arg); }

    <Z> void m1(F<Z> f, Z arg) {}
    <Z> void m2(Z arg, F<Z> f) {}

    void test() {
        m1(PrimitiveTypeBoxingTest::foo, 23); // expected: error
        m2(23, PrimitiveTypeBoxingTest::foo); // expected: error

        m1(PrimitiveTypeBoxingTest::bar, 23); // expected: success
        m2(23, PrimitiveTypeBoxingTest::bar); // expected: success
    }
}