test/tools/javac/6558548/T6558548.java

Wed, 27 Apr 2016 01:34:52 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:34:52 +0800
changeset 0
959103a6100f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17

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

mercurial