langtools/test/tools/javac/generics/7034511/T7034511b.java
author mcimadamore
Wed, 17 Jul 2013 14:14:49 +0100
changeset 18914 6edcda38fbdd
parent 17544 80db48a54a9f
permissions -rw-r--r--
7041019: Bogus type-variable substitution with array types with dependencies on accessibility check Summary: call to upperBound() when performing type-variable substitution on element type leads to unsoundness Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9301
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     1
/*
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
18914
6edcda38fbdd 7041019: Bogus type-variable substitution with array types with dependencies on accessibility check
mcimadamore
parents: 17544
diff changeset
     3
 * @bug     7034511 7040883 7041019
9301
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     4
 * @summary Loophole in typesafety
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     5
 * @compile/fail/ref=T7034511b.out -XDrawDiagnostics T7034511b.java
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     6
 */
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     7
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     8
class T7034511b {
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     9
    static class MyList<E> {
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    10
        E toArray(E[] e) { return null; }
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    11
    }
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    12
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    13
    void test(MyList<?> ml, Object o[]) {
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    14
        ml.toArray(o);
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    15
    }
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    16
}