Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/test/tools/javac/6558548/T6558548.java
38813 views
/*1* @test /nodynamiccopyright/2* @bug 6558548 70399373* @summary The compiler needs to be aligned with clarified specification of throws4* @compile/fail/ref=T6558548_latest.out -XDrawDiagnostics T6558548.java5* @compile/fail/ref=T6558548_6.out -source 6 -Xlint:-options -XDrawDiagnostics T6558548.java6*/78class T6558548 {910void nothing() {}11void checked() throws InterruptedException {}12void runtime() throws IllegalArgumentException {}1314void m1a() {15try {16throw new java.io.FileNotFoundException();17}18catch(java.io.FileNotFoundException exc) { }19catch(java.io.IOException exc) { } // 6: ok; latest: unreachable20}2122void m1b() {23try {24throw new java.io.IOException();25}26catch(java.io.FileNotFoundException exc) { }27catch(java.io.IOException exc) { } //ok28}2930void m1c() {31try {32throw new java.io.FileNotFoundException();33}34catch(java.io.FileNotFoundException exc) { }35catch(Exception ex) { } //ok (Exception/Throwable always allowed)36}3738void m1d() {39try {40throw new java.io.FileNotFoundException();41}42catch(java.io.FileNotFoundException exc) { }43catch(Throwable ex) { } //ok (Exception/Throwable always allowed)44}4546void m3() {47try {48checked();49}50catch(Exception exc) { } //ok51}5253void m4() {54try {55runtime();56}57catch(Exception exc) { } //ok58}5960void m5() {61try {62nothing();63}64catch(Throwable exc) { } //ok65}6667void m6() {68try {69checked();70}71catch(Throwable exc) { } //ok72}7374void m7() {75try {76runtime();77}78catch(Throwable exc) { } //ok79}8081void m9() {82try {83checked();84}85catch(Error exc) { }86catch(Throwable exc) { } //ok87}8889void m10() {90try {91runtime();92}93catch(Error exc) { }94catch(Throwable exc) { } //ok95}9697void m11() {98try {99nothing();100}101catch(Error exc) { }102catch(Throwable exc) { } //ok103}104105void m12() {106try {107checked();108}109catch(RuntimeException exc) { }110catch(Throwable exc) { } // ok111}112113void m13() {114try {115runtime();116}117catch(RuntimeException exc) { }118catch(Throwable exc) { } // ok119}120121void m14() {122try {123nothing();124}125catch(RuntimeException exc) { }126catch(Throwable exc) { } // ok127}128129void m15() {130try {131checked();132}133catch(RuntimeException exc) { }134catch(Exception exc) { } //ok135}136137void m16() {138try {139runtime();140}141catch(RuntimeException exc) { }142catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)143}144145void m17() {146try {147nothing();148}149catch(RuntimeException exc) { }150catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)151}152153void m18() {154try {155checked();156}157catch(RuntimeException exc) { }158catch(InterruptedException exc) { }159catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)160}161162void m19() {163try {164runtime();165}166catch(RuntimeException exc) { }167catch(InterruptedException exc) { } //never thrown in try168catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)169}170171void m20() {172try {173nothing();174}175catch(RuntimeException exc) { }176catch(InterruptedException exc) { } //never thrown in try177catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)178}179180void m21() {181try {182checked();183}184catch(RuntimeException exc) { }185catch(Exception exc) { } // ok186}187188void m22() {189try {190runtime();191}192catch(RuntimeException exc) { }193catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed)194}195196void m23() {197try {198nothing();199}200catch(RuntimeException exc) { }201catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed)202}203204void m24() {205try {206checked();207}208catch(RuntimeException exc) { }209catch(Error exc) { }210catch(Throwable exc) { } //ok211}212213void m25() {214try {215runtime();216}217catch(RuntimeException exc) { }218catch(Error exc) { }219catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)220}221222void m26() {223try {224nothing();225}226catch(RuntimeException exc) { }227catch(Error exc) { }228catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)229}230231void m27() {232try {233checked();234}235catch(RuntimeException exc) { }236catch(Error exc) { }237catch(InterruptedException exc) { }238catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)239}240241void m28() {242try {243runtime();244}245catch(RuntimeException exc) { }246catch(Error exc) { }247catch(InterruptedException exc) { } //never thrown in try248catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)249}250251void m29() {252try {253nothing();254}255catch(RuntimeException exc) { }256catch(Error exc) { }257catch(InterruptedException exc) { } //never thrown in try258catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)259}260261void m30() {262try {263checked();264}265catch(RuntimeException exc) { }266catch(Error exc) { }267catch(Throwable exc) { } //ok268}269270void m31() {271try {272runtime();273}274catch(RuntimeException exc) { }275catch(Error exc) { }276catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)277}278279void m32() {280try {281nothing();282}283catch(RuntimeException exc) { }284catch(Error exc) { }285catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)286}287288void m33() {289try {290checked();291}292catch(InterruptedException exc) { } //ok293}294295void m34() {296try {297runtime();298}299catch(InterruptedException exc) { } //never thrown in try300}301302void m35() {303try {304nothing();305}306catch(InterruptedException exc) { } //never thrown in try307}308}309310311