langtools/test/tools/javac/generics/diamond/neg/Neg07.java
author sadayapalam
Mon, 30 Mar 2015 17:09:14 +0530
changeset 29776 984a79b71cfe
parent 8635 383a416a2bdf
child 30014 fc1f2b200c1f
permissions -rw-r--r--
8062373: Project Coin: diamond and anonymous classes Summary: Allow diamond inference in combination with anonymous class instance creation Reviewed-by: mcimadamore, vromero Contributed-by: srikanth.adayapalam@oracle.com, maurizio.cimadamore@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5321
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
     1
/*
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
29776
984a79b71cfe 8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents: 8635
diff changeset
     3
 * @bug 6939620 7020044 8062373
5321
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
     4
 *
8635
383a416a2bdf 7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents: 5321
diff changeset
     5
 * @summary  Check that diamond works where LHS is supertype of RHS (1-ary constructor)
5321
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
     6
 * @author mcimadamore
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
     7
 * @compile/fail/ref=Neg07.out Neg07.java -XDrawDiagnostics
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
     8
 *
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
     9
 */
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
    10
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
    11
class Neg07 {
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
    12
   static class SuperFoo<X> {}
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
    13
   static class Foo<X extends Number> extends SuperFoo<X> {
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
    14
       Foo(X x) {}
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
    15
   }
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
    16
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
    17
   SuperFoo<String> sf1 = new Foo<>("");
29776
984a79b71cfe 8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents: 8635
diff changeset
    18
   SuperFoo<String> sf2 = new Foo<>("") {};
5321
c8efe769cb3b 6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff changeset
    19
}