langtools/test/tools/javac/generics/diamond/T6939780.java
author mcimadamore
Mon, 07 Mar 2011 14:31:50 +0000
changeset 8635 383a416a2bdf
parent 7081 94cfc5b65bed
permissions -rw-r--r--
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes Summary: Disallow diamond on anonymous innner class creation expression (as per JSR 334's EDR) Reviewed-by: jjg

/*
 * @test /nodynamiccopyright/
 * @bug 6939780 7020044
 *
 * @summary  add a warning to detect diamond sites
 * @author mcimadamore
 * @compile/ref=T6939780.out T6939780.java -XDrawDiagnostics -XDfindDiamond
 *
 */

class T6939780 {

    void test() {
        class Foo<X extends Number> {
            Foo() {}
            Foo(X x) {}
        }
        Foo<Number> f1 = new Foo<Number>(1);
        Foo<?> f2 = new Foo<Number>();
        Foo<?> f3 = new Foo<Integer>();
        Foo<Number> f4 = new Foo<Number>(1) {};
        Foo<?> f5 = new Foo<Number>() {};
        Foo<?> f6 = new Foo<Integer>() {};
    }
}