test/tools/javac/6558548/T6558548.java

Mon, 26 Oct 2015 13:23:30 -0700

author
asaha
date
Mon, 26 Oct 2015 13:23:30 -0700
changeset 2999
683b3e7e05a7
parent 990
9a847a77205d
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Added tag jdk8u76-b00 for changeset 10ffafaf5340

mcimadamore@935 1 /*
mcimadamore@935 2 * @test /nodynamiccopyright/
mcimadamore@990 3 * @bug 6558548 7039937
mcimadamore@935 4 * @summary The compiler needs to be aligned with clarified specification of throws
mcimadamore@935 5 * @compile/fail/ref=T6558548_latest.out -XDrawDiagnostics T6558548.java
mcimadamore@990 6 * @compile/fail/ref=T6558548_6.out -source 6 -Xlint:-options -XDrawDiagnostics T6558548.java
mcimadamore@935 7 */
mcimadamore@935 8
mcimadamore@935 9 class T6558548 {
mcimadamore@935 10
mcimadamore@935 11 void nothing() {}
mcimadamore@935 12 void checked() throws InterruptedException {}
mcimadamore@935 13 void runtime() throws IllegalArgumentException {}
mcimadamore@935 14
mcimadamore@990 15 void m1a() {
mcimadamore@935 16 try {
mcimadamore@935 17 throw new java.io.FileNotFoundException();
mcimadamore@935 18 }
mcimadamore@935 19 catch(java.io.FileNotFoundException exc) { }
mcimadamore@935 20 catch(java.io.IOException exc) { } // 6: ok; latest: unreachable
mcimadamore@935 21 }
mcimadamore@935 22
mcimadamore@990 23 void m1b() {
mcimadamore@935 24 try {
mcimadamore@935 25 throw new java.io.IOException();
mcimadamore@935 26 }
mcimadamore@935 27 catch(java.io.FileNotFoundException exc) { }
mcimadamore@935 28 catch(java.io.IOException exc) { } //ok
mcimadamore@935 29 }
mcimadamore@935 30
mcimadamore@990 31 void m1c() {
mcimadamore@935 32 try {
mcimadamore@990 33 throw new java.io.FileNotFoundException();
mcimadamore@935 34 }
mcimadamore@990 35 catch(java.io.FileNotFoundException exc) { }
mcimadamore@990 36 catch(Exception ex) { } //ok (Exception/Throwable always allowed)
mcimadamore@990 37 }
mcimadamore@990 38
mcimadamore@990 39 void m1d() {
mcimadamore@990 40 try {
mcimadamore@990 41 throw new java.io.FileNotFoundException();
mcimadamore@990 42 }
mcimadamore@990 43 catch(java.io.FileNotFoundException exc) { }
mcimadamore@990 44 catch(Throwable ex) { } //ok (Exception/Throwable always allowed)
mcimadamore@935 45 }
mcimadamore@935 46
mcimadamore@935 47 void m3() {
mcimadamore@935 48 try {
mcimadamore@935 49 checked();
mcimadamore@935 50 }
mcimadamore@935 51 catch(Exception exc) { } //ok
mcimadamore@935 52 }
mcimadamore@935 53
mcimadamore@935 54 void m4() {
mcimadamore@935 55 try {
mcimadamore@935 56 runtime();
mcimadamore@935 57 }
mcimadamore@935 58 catch(Exception exc) { } //ok
mcimadamore@935 59 }
mcimadamore@935 60
mcimadamore@935 61 void m5() {
mcimadamore@935 62 try {
mcimadamore@935 63 nothing();
mcimadamore@935 64 }
mcimadamore@935 65 catch(Throwable exc) { } //ok
mcimadamore@935 66 }
mcimadamore@935 67
mcimadamore@935 68 void m6() {
mcimadamore@935 69 try {
mcimadamore@935 70 checked();
mcimadamore@935 71 }
mcimadamore@935 72 catch(Throwable exc) { } //ok
mcimadamore@935 73 }
mcimadamore@935 74
mcimadamore@935 75 void m7() {
mcimadamore@935 76 try {
mcimadamore@935 77 runtime();
mcimadamore@935 78 }
mcimadamore@935 79 catch(Throwable exc) { } //ok
mcimadamore@935 80 }
mcimadamore@935 81
mcimadamore@935 82 void m9() {
mcimadamore@935 83 try {
mcimadamore@935 84 checked();
mcimadamore@935 85 }
mcimadamore@935 86 catch(Error exc) { }
mcimadamore@935 87 catch(Throwable exc) { } //ok
mcimadamore@935 88 }
mcimadamore@935 89
mcimadamore@935 90 void m10() {
mcimadamore@935 91 try {
mcimadamore@935 92 runtime();
mcimadamore@935 93 }
mcimadamore@935 94 catch(Error exc) { }
mcimadamore@935 95 catch(Throwable exc) { } //ok
mcimadamore@935 96 }
mcimadamore@935 97
mcimadamore@935 98 void m11() {
mcimadamore@935 99 try {
mcimadamore@935 100 nothing();
mcimadamore@935 101 }
mcimadamore@935 102 catch(Error exc) { }
mcimadamore@935 103 catch(Throwable exc) { } //ok
mcimadamore@935 104 }
mcimadamore@935 105
mcimadamore@935 106 void m12() {
mcimadamore@935 107 try {
mcimadamore@935 108 checked();
mcimadamore@935 109 }
mcimadamore@935 110 catch(RuntimeException exc) { }
mcimadamore@935 111 catch(Throwable exc) { } // ok
mcimadamore@935 112 }
mcimadamore@935 113
mcimadamore@935 114 void m13() {
mcimadamore@935 115 try {
mcimadamore@935 116 runtime();
mcimadamore@935 117 }
mcimadamore@935 118 catch(RuntimeException exc) { }
mcimadamore@935 119 catch(Throwable exc) { } // ok
mcimadamore@935 120 }
mcimadamore@935 121
mcimadamore@935 122 void m14() {
mcimadamore@935 123 try {
mcimadamore@935 124 nothing();
mcimadamore@935 125 }
mcimadamore@935 126 catch(RuntimeException exc) { }
mcimadamore@935 127 catch(Throwable exc) { } // ok
mcimadamore@935 128 }
mcimadamore@935 129
mcimadamore@935 130 void m15() {
mcimadamore@935 131 try {
mcimadamore@935 132 checked();
mcimadamore@935 133 }
mcimadamore@935 134 catch(RuntimeException exc) { }
mcimadamore@935 135 catch(Exception exc) { } //ok
mcimadamore@935 136 }
mcimadamore@935 137
mcimadamore@935 138 void m16() {
mcimadamore@935 139 try {
mcimadamore@935 140 runtime();
mcimadamore@935 141 }
mcimadamore@935 142 catch(RuntimeException exc) { }
mcimadamore@990 143 catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 144 }
mcimadamore@935 145
mcimadamore@935 146 void m17() {
mcimadamore@935 147 try {
mcimadamore@935 148 nothing();
mcimadamore@935 149 }
mcimadamore@935 150 catch(RuntimeException exc) { }
mcimadamore@990 151 catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 152 }
mcimadamore@935 153
mcimadamore@935 154 void m18() {
mcimadamore@935 155 try {
mcimadamore@935 156 checked();
mcimadamore@935 157 }
mcimadamore@935 158 catch(RuntimeException exc) { }
mcimadamore@935 159 catch(InterruptedException exc) { }
mcimadamore@990 160 catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 161 }
mcimadamore@935 162
mcimadamore@935 163 void m19() {
mcimadamore@935 164 try {
mcimadamore@935 165 runtime();
mcimadamore@935 166 }
mcimadamore@935 167 catch(RuntimeException exc) { }
mcimadamore@935 168 catch(InterruptedException exc) { } //never thrown in try
mcimadamore@990 169 catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 170 }
mcimadamore@935 171
mcimadamore@935 172 void m20() {
mcimadamore@935 173 try {
mcimadamore@935 174 nothing();
mcimadamore@935 175 }
mcimadamore@935 176 catch(RuntimeException exc) { }
mcimadamore@935 177 catch(InterruptedException exc) { } //never thrown in try
mcimadamore@990 178 catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 179 }
mcimadamore@935 180
mcimadamore@935 181 void m21() {
mcimadamore@935 182 try {
mcimadamore@935 183 checked();
mcimadamore@935 184 }
mcimadamore@935 185 catch(RuntimeException exc) { }
mcimadamore@935 186 catch(Exception exc) { } // ok
mcimadamore@935 187 }
mcimadamore@935 188
mcimadamore@935 189 void m22() {
mcimadamore@935 190 try {
mcimadamore@935 191 runtime();
mcimadamore@935 192 }
mcimadamore@935 193 catch(RuntimeException exc) { }
mcimadamore@990 194 catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 195 }
mcimadamore@935 196
mcimadamore@935 197 void m23() {
mcimadamore@935 198 try {
mcimadamore@935 199 nothing();
mcimadamore@935 200 }
mcimadamore@935 201 catch(RuntimeException exc) { }
mcimadamore@990 202 catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 203 }
mcimadamore@935 204
mcimadamore@935 205 void m24() {
mcimadamore@935 206 try {
mcimadamore@935 207 checked();
mcimadamore@935 208 }
mcimadamore@935 209 catch(RuntimeException exc) { }
mcimadamore@935 210 catch(Error exc) { }
mcimadamore@935 211 catch(Throwable exc) { } //ok
mcimadamore@935 212 }
mcimadamore@935 213
mcimadamore@935 214 void m25() {
mcimadamore@935 215 try {
mcimadamore@935 216 runtime();
mcimadamore@935 217 }
mcimadamore@935 218 catch(RuntimeException exc) { }
mcimadamore@935 219 catch(Error exc) { }
mcimadamore@990 220 catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 221 }
mcimadamore@935 222
mcimadamore@935 223 void m26() {
mcimadamore@935 224 try {
mcimadamore@935 225 nothing();
mcimadamore@935 226 }
mcimadamore@935 227 catch(RuntimeException exc) { }
mcimadamore@935 228 catch(Error exc) { }
mcimadamore@990 229 catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 230 }
mcimadamore@935 231
mcimadamore@935 232 void m27() {
mcimadamore@935 233 try {
mcimadamore@935 234 checked();
mcimadamore@935 235 }
mcimadamore@935 236 catch(RuntimeException exc) { }
mcimadamore@935 237 catch(Error exc) { }
mcimadamore@935 238 catch(InterruptedException exc) { }
mcimadamore@990 239 catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 240 }
mcimadamore@935 241
mcimadamore@935 242 void m28() {
mcimadamore@935 243 try {
mcimadamore@935 244 runtime();
mcimadamore@935 245 }
mcimadamore@935 246 catch(RuntimeException exc) { }
mcimadamore@935 247 catch(Error exc) { }
mcimadamore@935 248 catch(InterruptedException exc) { } //never thrown in try
mcimadamore@990 249 catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 250 }
mcimadamore@935 251
mcimadamore@935 252 void m29() {
mcimadamore@935 253 try {
mcimadamore@935 254 nothing();
mcimadamore@935 255 }
mcimadamore@935 256 catch(RuntimeException exc) { }
mcimadamore@935 257 catch(Error exc) { }
mcimadamore@935 258 catch(InterruptedException exc) { } //never thrown in try
mcimadamore@990 259 catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 260 }
mcimadamore@935 261
mcimadamore@935 262 void m30() {
mcimadamore@935 263 try {
mcimadamore@935 264 checked();
mcimadamore@935 265 }
mcimadamore@935 266 catch(RuntimeException exc) { }
mcimadamore@935 267 catch(Error exc) { }
mcimadamore@935 268 catch(Throwable exc) { } //ok
mcimadamore@935 269 }
mcimadamore@935 270
mcimadamore@935 271 void m31() {
mcimadamore@935 272 try {
mcimadamore@935 273 runtime();
mcimadamore@935 274 }
mcimadamore@935 275 catch(RuntimeException exc) { }
mcimadamore@935 276 catch(Error exc) { }
mcimadamore@990 277 catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 278 }
mcimadamore@935 279
mcimadamore@935 280 void m32() {
mcimadamore@935 281 try {
mcimadamore@935 282 nothing();
mcimadamore@935 283 }
mcimadamore@935 284 catch(RuntimeException exc) { }
mcimadamore@935 285 catch(Error exc) { }
mcimadamore@990 286 catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
mcimadamore@935 287 }
mcimadamore@935 288
mcimadamore@935 289 void m33() {
mcimadamore@935 290 try {
mcimadamore@935 291 checked();
mcimadamore@935 292 }
mcimadamore@935 293 catch(InterruptedException exc) { } //ok
mcimadamore@935 294 }
mcimadamore@935 295
mcimadamore@935 296 void m34() {
mcimadamore@935 297 try {
mcimadamore@935 298 runtime();
mcimadamore@935 299 }
mcimadamore@935 300 catch(InterruptedException exc) { } //never thrown in try
mcimadamore@935 301 }
mcimadamore@935 302
mcimadamore@935 303 void m35() {
mcimadamore@935 304 try {
mcimadamore@935 305 nothing();
mcimadamore@935 306 }
mcimadamore@935 307 catch(InterruptedException exc) { } //never thrown in try
mcimadamore@935 308 }
mcimadamore@935 309 }

mercurial