langtools/test/tools/javac/generics/7034511/T7034511b.java
author mcimadamore
Tue, 12 Apr 2011 20:56:16 -0700
changeset 9301 da48f63f0b22
child 9607 94b7adcaccad
permissions -rw-r--r--
7034511: Loophole in typesafety Summary: Type-variable substutution takes upper bound of replaced captured type-variable Reviewed-by: dlsmith
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/
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     3
 * @bug     7034511
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
}