test/tools/javac/generics/diamond/T6939780.java

changeset 731
fadc6d3e63f4
child 914
ca32f2986301
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/generics/diamond/T6939780.java	Tue Nov 02 12:01:35 2010 +0000
     1.3 @@ -0,0 +1,25 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 6939780
     1.7 + *
     1.8 + * @summary  add a warning to detect diamond sites
     1.9 + * @author mcimadamore
    1.10 + * @compile/ref=T6939780.out T6939780.java -XDrawDiagnostics -XDfindDiamond
    1.11 + *
    1.12 + */
    1.13 +
    1.14 +class T6939780 {
    1.15 +
    1.16 +    void test() {
    1.17 +        class Foo<X extends Number> {
    1.18 +            Foo() {}
    1.19 +            Foo(X x) {}
    1.20 +        }
    1.21 +        Foo<Number> f1 = new Foo<Number>(1);
    1.22 +        Foo<?> f2 = new Foo<Number>();
    1.23 +        Foo<?> f3 = new Foo<Integer>();
    1.24 +        Foo<Number> f4 = new Foo<Number>(1) {};
    1.25 +        Foo<?> f5 = new Foo<Number>() {};
    1.26 +        Foo<?> f6 = new Foo<Integer>() {};
    1.27 +    }
    1.28 +}

mercurial