langtools/test/tools/javac/lambda/MostSpecific32.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=MostSpecific32.out -XDrawDiagnostics MostSpecific32.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 MostSpecific32 {
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 A<T> {}
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    10
    interface B<T> extends A<T> {}
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
    interface F1<S> { A<S> apply(); }
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    13
    interface F2<S> { B<S> apply(); }
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 void m1(F1<? extends Number> f1) {}
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    16
    static void m1(F2<? extends Number> f2) {}
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    17
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    18
    void test() {
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    19
        m1(() -> null); // B<CAP ext Number> </: A<Number>
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
5b15a5ed3b0d 8144767: Fix handling of capture variables in most-specific test
dlsmith
parents:
diff changeset
    22
}