langtools/test/tools/javac/lambda/MostSpecific31.java
author dlsmith
Fri, 10 Jun 2016 15:08:00 -0600
changeset 38913 5b15a5ed3b0d
permissions -rw-r--r--
8144767: Fix handling of capture variables in most-specific test Reviewed-by: vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38913
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
     1
/*
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
     3
 * @bug 8144767
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
     4
 * @summary Correct most-specific test when wildcards appear in functional interface type
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
     5
 * @compile/fail/ref=MostSpecific31.out -XDrawDiagnostics MostSpecific31.java
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
     6
 */
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
     7
class MostSpecific31 {
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
     8
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
     9
    interface Pred<T> { boolean test(T arg); }
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    10
    interface Fun<T,R> { R apply(T arg); }
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    11
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    12
    static void m1(Pred<? super Number> f) {}
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    13
    static void m1(Fun<Integer, Boolean> f) {}
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    14
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    15
    static boolean foo(Object arg) { return false; }
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    16
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    17
    void test() {
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    18
        m1(MostSpecific31::foo);
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    19
    }
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    20
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    21
}