author | hseigel |
Wed, 02 Mar 2016 23:48:41 +0000 | |
changeset 36397 | c487ced7231c |
parent 29776 | 984a79b71cfe |
permissions | -rw-r--r-- |
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:
5327
diff
changeset
|
5 |
* @summary Check that diamond fails when inference violates declared bounds |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
6 |
* (basic test with nested class, generic/non-generic constructors) |
5321
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
7 |
* @author mcimadamore |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
8 |
* @compile/fail/ref=Neg01.out Neg01.java -XDrawDiagnostics |
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 |
|
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
12 |
class Neg01<X extends Number> { |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
13 |
|
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
14 |
Neg01(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 |
<Z> Neg01(X x, Z z) {} |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
17 |
|
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
18 |
void test() { |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
19 |
Neg01<String> n1 = new Neg01<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
20 |
Neg01<? extends String> n2 = new Neg01<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
21 |
Neg01<?> n3 = new Neg01<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
22 |
Neg01<? super String> n4 = new Neg01<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
23 |
|
8635
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
24 |
Neg01<String> n5 = new Neg01<>("", ""); |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
25 |
Neg01<? extends String> n6 = new Neg01<>("", ""); |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
26 |
Neg01<?> n7 = new Neg01<>("", ""); |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
27 |
Foo<? super String> n8 = new Neg01<>("", ""); |
29776
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
28 |
|
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
29 |
Neg01<String> n9 = new Neg01<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
30 |
Neg01<? extends String> n10 = new Neg01<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
31 |
Neg01<?> n11 = new Neg01<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
32 |
Neg01<? super String> n12 = new Neg01<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
33 |
|
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
34 |
Neg01<String> n13 = new Neg01<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
35 |
Neg01<? extends String> n14 = new Neg01<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
36 |
Neg01<?> n15 = new Neg01<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
37 |
Neg01<? super String> n16 = new Neg01<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
38 |
|
5321
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
39 |
} |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
40 |
} |