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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25444
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
     1
/*
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
     3
 * @bug 8033483
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
     4
 * @summary Should ignore nested lambda bodies during overload resolution
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
     5
 * @compile/fail/ref=IgnoreLambdaBodyDuringResolutionTest1.out -XDrawDiagnostics IgnoreLambdaBodyDuringResolutionTest1.java
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
     6
 */
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
     7
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
     8
class IgnoreLambdaBodyDuringResolutionTest1 {
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
     9
    interface SAM<T> {
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    10
        T action(T t);
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    11
    }
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    12
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    13
    <T> T m(SAM<T> op) {
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    14
        return null;
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    15
    }
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    16
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    17
    class B {
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    18
        B x() {
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    19
            return this;
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    20
        }
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    21
    }
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    22
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    23
    class C {}
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    24
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    25
    void foo(B arg) {}
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    26
    void foo(C arg) {}
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    27
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    28
    void bar() {
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    29
        foo(m(arg -> new B()));
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    30
    }
27045478cf23 8033483: Should ignore nested lambda bodies during overload resolution
vromero
parents:
diff changeset
    31
}