mcimadamore@935: /* mcimadamore@935: * @test /nodynamiccopyright/ mcimadamore@990: * @bug 6558548 7039937 mcimadamore@935: * @summary The compiler needs to be aligned with clarified specification of throws mcimadamore@935: * @compile/fail/ref=T6558548_latest.out -XDrawDiagnostics T6558548.java mcimadamore@990: * @compile/fail/ref=T6558548_6.out -source 6 -Xlint:-options -XDrawDiagnostics T6558548.java mcimadamore@935: */ mcimadamore@935: mcimadamore@935: class T6558548 { mcimadamore@935: mcimadamore@935: void nothing() {} mcimadamore@935: void checked() throws InterruptedException {} mcimadamore@935: void runtime() throws IllegalArgumentException {} mcimadamore@935: mcimadamore@990: void m1a() { mcimadamore@935: try { mcimadamore@935: throw new java.io.FileNotFoundException(); mcimadamore@935: } mcimadamore@935: catch(java.io.FileNotFoundException exc) { } mcimadamore@935: catch(java.io.IOException exc) { } // 6: ok; latest: unreachable mcimadamore@935: } mcimadamore@935: mcimadamore@990: void m1b() { mcimadamore@935: try { mcimadamore@935: throw new java.io.IOException(); mcimadamore@935: } mcimadamore@935: catch(java.io.FileNotFoundException exc) { } mcimadamore@935: catch(java.io.IOException exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@990: void m1c() { mcimadamore@935: try { mcimadamore@990: throw new java.io.FileNotFoundException(); mcimadamore@935: } mcimadamore@990: catch(java.io.FileNotFoundException exc) { } mcimadamore@990: catch(Exception ex) { } //ok (Exception/Throwable always allowed) mcimadamore@990: } mcimadamore@990: mcimadamore@990: void m1d() { mcimadamore@990: try { mcimadamore@990: throw new java.io.FileNotFoundException(); mcimadamore@990: } mcimadamore@990: catch(java.io.FileNotFoundException exc) { } mcimadamore@990: catch(Throwable ex) { } //ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m3() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(Exception exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m4() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(Exception exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m5() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(Throwable exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m6() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(Throwable exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m7() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(Throwable exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m9() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(Error exc) { } mcimadamore@935: catch(Throwable exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m10() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(Error exc) { } mcimadamore@935: catch(Throwable exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m11() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(Error exc) { } mcimadamore@935: catch(Throwable exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m12() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Throwable exc) { } // ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m13() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Throwable exc) { } // ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m14() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Throwable exc) { } // ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m15() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Exception exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m16() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@990: catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m17() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@990: catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m18() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(InterruptedException exc) { } mcimadamore@990: catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m19() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(InterruptedException exc) { } //never thrown in try mcimadamore@990: catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m20() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(InterruptedException exc) { } //never thrown in try mcimadamore@990: catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m21() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Exception exc) { } // ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m22() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@990: catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m23() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@990: catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m24() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Error exc) { } mcimadamore@935: catch(Throwable exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m25() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Error exc) { } mcimadamore@990: catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m26() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Error exc) { } mcimadamore@990: catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m27() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Error exc) { } mcimadamore@935: catch(InterruptedException exc) { } mcimadamore@990: catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m28() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Error exc) { } mcimadamore@935: catch(InterruptedException exc) { } //never thrown in try mcimadamore@990: catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m29() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Error exc) { } mcimadamore@935: catch(InterruptedException exc) { } //never thrown in try mcimadamore@990: catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m30() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Error exc) { } mcimadamore@935: catch(Throwable exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m31() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Error exc) { } mcimadamore@990: catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m32() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(RuntimeException exc) { } mcimadamore@935: catch(Error exc) { } mcimadamore@990: catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m33() { mcimadamore@935: try { mcimadamore@935: checked(); mcimadamore@935: } mcimadamore@935: catch(InterruptedException exc) { } //ok mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m34() { mcimadamore@935: try { mcimadamore@935: runtime(); mcimadamore@935: } mcimadamore@935: catch(InterruptedException exc) { } //never thrown in try mcimadamore@935: } mcimadamore@935: mcimadamore@935: void m35() { mcimadamore@935: try { mcimadamore@935: nothing(); mcimadamore@935: } mcimadamore@935: catch(InterruptedException exc) { } //never thrown in try mcimadamore@935: } mcimadamore@935: }