test/langtools/tools/javac/generics/7034019/T7034019c.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:
9302
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
     1
/*
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
     3
 * @bug 7034019
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
     4
 * @summary ClassCastException in javac with conjunction types
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
     5
 *
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
     6
 * @compile/fail/ref=T7034019c.out -XDrawDiagnostics T7034019c.java
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
     7
 */
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
     8
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
     9
class T7034019c {
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    10
    interface A {
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    11
        abstract <T extends Number> T foo();
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    12
    }
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    13
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    14
    interface B {
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    15
        abstract <T> T foo();
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    16
    }
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    17
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    18
    static class C<T extends A & B> {
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    19
        void test(T x) {
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    20
            x.foo();
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    21
        }
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    22
    }
13a19cf713fd 7034019: ClassCastException in javac with conjunction types
mcimadamore
parents:
diff changeset
    23
}