langtools/test/tools/javac/lambda/T8033483/IgnoreLambdaBodyDuringResolutionTest1.java
author vromero
Wed, 09 Jul 2014 10:49:32 -0400
changeset 25444 27045478cf23
permissions -rw-r--r--
8033483: Should ignore nested lambda bodies during overload resolution Reviewed-by: mcimadamore, dlsmith

/*
 * @test /nodynamiccopyright/
 * @bug 8033483
 * @summary Should ignore nested lambda bodies during overload resolution
 * @compile/fail/ref=IgnoreLambdaBodyDuringResolutionTest1.out -XDrawDiagnostics IgnoreLambdaBodyDuringResolutionTest1.java
 */

class IgnoreLambdaBodyDuringResolutionTest1 {
    interface SAM<T> {
        T action(T t);
    }

    <T> T m(SAM<T> op) {
        return null;
    }

    class B {
        B x() {
            return this;
        }
    }

    class C {}

    void foo(B arg) {}
    void foo(C arg) {}

    void bar() {
        foo(m(arg -> new B()));
    }
}