test/langtools/tools/javac/generics/diamond/7188968/T7188968.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 14051 langtools/test/tools/javac/generics/diamond/7188968/T7188968.java@9097cec96212
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14051
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
     1
/*
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
     3
 * @bug 7188968
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
     4
 *
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
     5
 * @summary  Diamond: javac generates diamond inference errors when in 'finder' mode
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
     6
 * @author mcimadamore
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
     7
 * @compile/fail/ref=T7188968.out -Xlint:unchecked -XDrawDiagnostics T7188968.java
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
     8
 *
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
     9
 */
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    10
import java.util.List;
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    11
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    12
class T7188968 {
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    13
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    14
    static class Foo<X> {
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    15
        Foo(List<X> ls, Object o) { }
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    16
        static <Z> Foo<Z> makeFoo(List<Z> lz, Object o) { return null; }
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    17
    }
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    18
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    19
    void test(List l) {
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    20
        new Foo(l, unknown);
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    21
        new Foo(l, unknown) { };
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    22
        new Foo<>(l, unknown);
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    23
        Foo.makeFoo(l, unknown);
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    24
    }
9097cec96212 7188968: New instance creation expression using diamond is checked twice
mcimadamore
parents:
diff changeset
    25
}