langtools/test/tools/javac/generics/diamond/neg/Neg07.java
author sadayapalam
Thu, 26 Nov 2015 17:38:15 +0530
changeset 34474 14deea5f86f1
parent 30014 fc1f2b200c1f
permissions -rw-r--r--
8078660: Misleading recommendation from diamond finder. Summary: javac should recommend diamond usage if that could lead to a change in program behavior. Reviewed-by: mcimadamore

/*
 * @test /nodynamiccopyright/
 * @bug 6939620 7020044 8062373 8078024
 *
 * @summary  Check that diamond works where LHS is supertype of RHS (1-ary constructor)
 * @author mcimadamore
 * @compile/fail/ref=Neg07.out Neg07.java -XDrawDiagnostics
 *
 */

class Neg07 {
   static class SuperFoo<X> {}
   static class Foo<X extends Number> extends SuperFoo<X> {
       Foo(X x) {}
   }

   SuperFoo<String> sf1 = new Foo<>("");
   SuperFoo<String> sf2 = new Foo<>("") {};
}