test/langtools/tools/javac/generics/odersky/BadTest3.java
author darcy
Thu, 12 Jul 2018 14:13:15 -0700
changeset 51047 860a3648c494
parent 47216 71c04702a3d5
permissions -rw-r--r--
8028563: Remove javac support for 6/1.6 source and target values Reviewed-by: jjg, erikj, henryjen
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
30721
1024d425d97e 8074425: Group 13b: golden files for tests in tools/javac/generics dir
sogoel
parents: 5520
diff changeset
     2
 * @test /nodynamiccopyright/
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @summary Negative regression test from odersky
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @author odersky
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 *
30721
1024d425d97e 8074425: Group 13b: golden files for tests in tools/javac/generics dir
sogoel
parents: 5520
diff changeset
     6
 * @compile/fail/ref=BadTest3.out -XDrawDiagnostics  BadTest3.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
class BadTest3 {
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
    interface I {}
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
    interface J {}
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
    static class C implements I, J {}
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
    static class D implements I, J {}
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
    interface Ord {}
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
    static class Main {
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
        static C c = new C();
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
        static D d = new D();
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
        static <B extends Ord> List<B> nil() { return new List<B>(); }
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
        static <B extends I & J> B f(B x) { return x; }
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
        static <A> List<A> cons(A x, List<A> xs) { return xs.prepend(x); }
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
        static <A> Cell<A> makeCell(A x) { return new Cell<A>(x); }
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
        static <A> A id(A x) { return x; }
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
        public static void main(String[] args) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
            List<String> xs = nil();
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
            f(null);
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
            f(nil());
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
            I i = f(null);
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
            J j = f(nil());
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
}