langtools/test/tools/javac/generics/7034511/T7034511a.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=T7034511a.out -XDrawDiagnostics T7034511a.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 T7034511a {
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
     9
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    10
    interface A<T> {
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    11
        void foo(T x);
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    12
    }
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    13
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    14
    interface B<T> extends A<T[]> { }
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    15
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    16
    static abstract class C implements B<Integer> {
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    17
        <T extends B<?>> void test(T x, String[] ss) {
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    18
            x.foo(ss);
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    19
        }
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    20
    }
da48f63f0b22 7034511: Loophole in typesafety
mcimadamore
parents:
diff changeset
    21
}