author | sadayapalam |
Thu, 26 Nov 2015 17:38:15 +0530 | |
changeset 34474 | 14deea5f86f1 |
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 usage of rare types doesn't cause spurious diamond diagnostics |
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=Neg05.out Neg05.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 Neg05<U> { |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
12 |
|
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
13 |
class Foo<V> { |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
14 |
Foo(V x) {} |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
15 |
<Z> Foo(V x, Z z) {} |
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 |
|
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
18 |
void testRare_1() { |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
19 |
Neg05<?>.Foo<String> f1 = new Neg05.Foo<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
20 |
Neg05<?>.Foo<? extends String> f2 = new Neg05.Foo<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
21 |
Neg05<?>.Foo<?> f3 = new Neg05.Foo<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
22 |
Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<>(""); |
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 |
Neg05<?>.Foo<String> f5 = new Neg05.Foo<>("", ""); |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
25 |
Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<>("", ""); |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
26 |
Neg05<?>.Foo<?> f7 = new Neg05.Foo<>("", ""); |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
27 |
Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<>("", ""); |
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 |
Neg05<?>.Foo<String> f9 = new Neg05.Foo<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
30 |
Neg05<?>.Foo<? extends String> f10 = new Neg05.Foo<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
31 |
Neg05<?>.Foo<?> f11 = new Neg05.Foo<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
32 |
Neg05<?>.Foo<? super String> f12 = new Neg05.Foo<>(""){}; |
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 |
Neg05<?>.Foo<String> f13 = new Neg05.Foo<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
35 |
Neg05<?>.Foo<? extends String> f14 = new Neg05.Foo<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
36 |
Neg05<?>.Foo<?> f15 = new Neg05.Foo<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
37 |
Neg05<?>.Foo<? super String> f16 = new Neg05.Foo<>("", ""){}; |
5321
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
38 |
} |
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 |
void testRare_2(Neg05 n) { |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
41 |
Neg05<?>.Foo<String> f1 = n.new Foo<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
42 |
Neg05<?>.Foo<? extends String> f2 = n.new Foo<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
43 |
Neg05<?>.Foo<?> f3 = n.new Foo<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
44 |
Neg05<?>.Foo<? super String> f4 = n.new Foo<>(""); |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
45 |
|
8635
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
46 |
Neg05<?>.Foo<String> f5 = n.new Foo<>("", ""); |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
47 |
Neg05<?>.Foo<? extends String> f6 = n.new Foo<>("", ""); |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
48 |
Neg05<?>.Foo<?> f7 = n.new Foo<>("", ""); |
383a416a2bdf
7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes
mcimadamore
parents:
5327
diff
changeset
|
49 |
Neg05<?>.Foo<? super String> f8 = n.new Foo<>("", ""); |
29776
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
50 |
|
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
51 |
Neg05<?>.Foo<String> f9 = n.new Foo<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
52 |
Neg05<?>.Foo<? extends String> f10 = n.new Foo<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
53 |
Neg05<?>.Foo<?> f11 = n.new Foo<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
54 |
Neg05<?>.Foo<? super String> f12 = n.new Foo<>(""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
55 |
|
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
56 |
Neg05<?>.Foo<String> f13 = n.new Foo<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
57 |
Neg05<?>.Foo<? extends String> f14 = n.new Foo<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
58 |
Neg05<?>.Foo<?> f15 = n.new Foo<>("", ""){}; |
984a79b71cfe
8062373: Project Coin: diamond and anonymous classes
sadayapalam
parents:
8635
diff
changeset
|
59 |
Neg05<?>.Foo<? super String> f16 = n.new Foo<>("", ""){}; |
5321
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
60 |
} |
c8efe769cb3b
6939620: Switch to 'complex' diamond inference scheme
mcimadamore
parents:
diff
changeset
|
61 |
} |