langtools/test/tools/javac/lambda/MethodReference43.java
author lana
Tue, 25 Apr 2017 07:38:50 +0000
changeset 44909 b53c770dc04f
parent 30014 fc1f2b200c1f
permissions -rw-r--r--
Added tag jdk-10+1 for changeset 3a409afd3f86
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     1
/*
19929
39df7cd8039a 8024154: Fix for 8016177: structural most specific and stuckness breaks 6 langtools tests
vromero
parents: 19914
diff changeset
     2
 * @test /nodynamiccopyright/
30014
fc1f2b200c1f 8078024: javac, several incorporation steps are silently failing when an error should be reported
vromero
parents: 19929
diff changeset
     3
 * @bug 8003280 8078024
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     4
 * @summary Add lambda tests
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     5
 *  check that diamond inference is applied when using raw constructor reference qualifier
19914
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
     6
 * @compile/fail/ref=MethodReference43.out -XDrawDiagnostics MethodReference43.java
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     7
 */
19929
39df7cd8039a 8024154: Fix for 8016177: structural most specific and stuckness breaks 6 langtools tests
vromero
parents: 19914
diff changeset
     8
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     9
public class MethodReference43 {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    10
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    11
    interface SAM1 {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    12
       Foo<?> m(String s);
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    13
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    14
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    15
    interface SAM2 {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    16
       Foo<?> m(Integer s);
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    17
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    18
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    19
    interface SAM3 {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    20
       Foo<?> m(Object o);
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    21
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    22
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    23
    interface SAM4 {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    24
       Foo<Number> m(Integer o);
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    25
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    26
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    27
    static class Foo<X extends Number> {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    28
        Foo(X x) { }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    29
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    30
19914
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    31
    static void m1(SAM1 s) { }
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    32
19914
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    33
    static void m2(SAM2 s) { }
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    34
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    35
    static void m3(SAM3 s) { }
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    36
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    37
    static void m4(SAM4 s) { }
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    38
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    39
    static void m5(SAM1 s) { }
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    40
    static void m5(SAM2 s) { }
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    41
    static void m5(SAM3 s) { }
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    42
    static void m5(SAM4 s) { }
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    43
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    44
    public static void main(String[] args) {
19914
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    45
        m1(Foo::new);
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    46
        m2(Foo::new);
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    47
        m3(Foo::new);
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    48
        m4(Foo::new);
d86271bd430a 8016177: structural most specific and stuckness
vromero
parents: 15374
diff changeset
    49
        m5(Foo::new);
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    50
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    51
}