author | mcimadamore |
Mon, 28 Feb 2011 11:48:53 +0000 | |
changeset 8616 | 5a47f5535883 |
child 18909 | 8f9fc5d876e4 |
permissions | -rw-r--r-- |
8616
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
1 |
/* |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
3 |
* @bug 7015430 |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
4 |
* |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
5 |
* @summary Incorrect thrown type determined for unchecked invocations |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
6 |
* @author Daniel Smith |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
7 |
* @compile/fail/ref=T7015430.out -Xlint:unchecked -XDrawDiagnostics T7015430.java |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
8 |
* |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
9 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
10 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
11 |
class T7015430 { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
12 |
static <E extends Exception> Iterable<E> empty(Iterable<E> arg) throws E { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
13 |
return null; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
14 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
15 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
16 |
<E extends Exception> T7015430(Iterable<E> arg) throws E { } |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
17 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
18 |
static <E extends Exception> Iterable<E> empty2(Iterable x) throws E { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
19 |
return null; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
20 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
21 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
22 |
static class Foo<X extends Exception> { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
23 |
Foo() throws X {} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
24 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
25 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
26 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
27 |
* Method invocation, no unchecked |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
28 |
* inferred: RuntimeException - should pass |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
29 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
30 |
void m1() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
31 |
Iterable<RuntimeException> i = java.util.Collections.emptyList(); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
32 |
empty(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
33 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
34 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
35 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
36 |
* Method invocation, unchecked, inferred arguments |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
37 |
* inferred: Exception - should fail |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
38 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
39 |
void m2() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
40 |
Iterable i = java.util.Collections.EMPTY_LIST; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
41 |
empty(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
42 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
43 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
44 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
45 |
* Method invocation, unchecked, explicit arguments |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
46 |
* inferred: RuntimeException - should pass |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
47 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
48 |
void m3() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
49 |
Iterable i = java.util.Collections.EMPTY_LIST; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
50 |
T7015430.<RuntimeException>empty(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
51 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
52 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
53 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
54 |
* Constructor invocation, no unchecked |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
55 |
* inferred: RuntimeException - should pass |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
56 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
57 |
void m4() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
58 |
Iterable<RuntimeException> i = java.util.Collections.emptyList(); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
59 |
new T7015430(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
60 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
61 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
62 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
63 |
* Constructor invocation, unchecked, inferred arguments |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
64 |
* inferred: Exception - should fail |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
65 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
66 |
void m5() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
67 |
Iterable i = java.util.Collections.EMPTY_LIST; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
68 |
new T7015430(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
69 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
70 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
71 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
72 |
* Constructor invocation, unchecked, explicit arguments |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
73 |
* inferred: RuntimeException - should pass |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
74 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
75 |
void m6() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
76 |
Iterable i = java.util.Collections.EMPTY_LIST; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
77 |
new <RuntimeException>T7015430(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
78 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
79 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
80 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
81 |
* Method invocation, no unchecked, inferred arguments |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
82 |
* inferred: RuntimeException - should pass |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
83 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
84 |
void m7() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
85 |
Iterable i = java.util.Collections.EMPTY_LIST; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
86 |
Iterable<RuntimeException> e = empty2(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
87 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
88 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
89 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
90 |
* Method invocation, no unchecked, inferred arguments |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
91 |
* inferred: Exception - should fail |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
92 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
93 |
void m8() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
94 |
Iterable i = java.util.Collections.EMPTY_LIST; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
95 |
empty2(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
96 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
97 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
98 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
99 |
* Constructor invocation, unchecked, explicit arguments |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
100 |
* inferred: RuntimeException - should pass |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
101 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
102 |
void m9() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
103 |
Iterable i = java.util.Collections.EMPTY_LIST; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
104 |
new <RuntimeException> T7015430(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
105 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
106 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
107 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
108 |
* Constructor invocation, unchecked, inferred arguments |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
109 |
* inferred: Exception - should fail |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
110 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
111 |
void m10() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
112 |
Iterable i = java.util.Collections.EMPTY_LIST; |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
113 |
new T7015430(i); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
114 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
115 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
116 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
117 |
* Constructor invocation, no unchecked, inferred arguments (diamond) |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
118 |
* inferred: RuntimeException - should pass |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
119 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
120 |
void m11() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
121 |
Foo<RuntimeException> o = new Foo<>(); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
122 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
123 |
|
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
124 |
/** |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
125 |
* Constructor invocation, no unchecked, inferred arguments (diamond) |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
126 |
* inferred: Exception - should fail |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
127 |
*/ |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
128 |
void m12() { |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
129 |
new Foo<>(); |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
130 |
} |
5a47f5535883
7015430: Incorrect thrown type determined for unchecked invocations
mcimadamore
parents:
diff
changeset
|
131 |
} |