langtools/test/tools/javac/lambda/8074381/T8074381a.java
author jjg
Mon, 18 Apr 2016 18:41:38 -0700
changeset 37636 6c6e6e25189d
parent 29553 716d47f5a45e
permissions -rw-r--r--
8154504: javac tests fail after JDK API is deprecated Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29553
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
     1
/*
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
     3
 * @bug 8074381
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
     4
 * @summary java.lang.AssertionError during compiling
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
     5
 * @compile/fail/ref=T8074381a.out -XDrawDiagnostics T8074381a.java
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
     6
 */
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
     7
class T8074381a {
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
     8
    interface Sup<X> {
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
     9
        boolean m(X x);
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    10
    }
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    11
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    12
    interface Sub<X> extends Sup<String> {
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    13
        boolean m(String s);
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    14
    }
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    15
37636
6c6e6e25189d 8154504: javac tests fail after JDK API is deprecated
jjg
parents: 29553
diff changeset
    16
    @SuppressWarnings("deprecation")
29553
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    17
    void testRaw() {
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    18
        Sub s1 = c -> true;
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    19
        Sub s2 = Boolean::new;
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    20
        Sub s3 = new Sub() {
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    21
            @Override
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    22
            public boolean m(String o) { return true; }
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    23
        };
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    24
    }
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    25
37636
6c6e6e25189d 8154504: javac tests fail after JDK API is deprecated
jjg
parents: 29553
diff changeset
    26
    @SuppressWarnings("deprecation")
29553
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    27
    void testNonRaw() {
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    28
        Sub<Integer> s1 = c -> true;
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    29
        Sub<Integer> s2 = Boolean::new;
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    30
        Sub<Integer> s3 = new Sub<Integer>() {
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    31
            @Override
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    32
            public boolean m(String o) { return true; }
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    33
        };
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    34
    }
716d47f5a45e 8074381: java.lang.AssertionError during compiling
mcimadamore
parents:
diff changeset
    35
}