1.1 --- a/test/tools/javac/6558548/T6558548.java Fri Apr 29 16:05:02 2011 +0100 1.2 +++ b/test/tools/javac/6558548/T6558548.java Fri Apr 29 16:05:29 2011 +0100 1.3 @@ -1,9 +1,9 @@ 1.4 /* 1.5 * @test /nodynamiccopyright/ 1.6 - * @bug 6558548 1.7 + * @bug 6558548 7039937 1.8 * @summary The compiler needs to be aligned with clarified specification of throws 1.9 * @compile/fail/ref=T6558548_latest.out -XDrawDiagnostics T6558548.java 1.10 - * @compile/fail/ref=T6558548_6.out -source 6 -XDrawDiagnostics T6558548.java 1.11 + * @compile/fail/ref=T6558548_6.out -source 6 -Xlint:-options -XDrawDiagnostics T6558548.java 1.12 */ 1.13 1.14 class T6558548 { 1.15 @@ -12,7 +12,7 @@ 1.16 void checked() throws InterruptedException {} 1.17 void runtime() throws IllegalArgumentException {} 1.18 1.19 - void m1() { 1.20 + void m1a() { 1.21 try { 1.22 throw new java.io.FileNotFoundException(); 1.23 } 1.24 @@ -20,7 +20,7 @@ 1.25 catch(java.io.IOException exc) { } // 6: ok; latest: unreachable 1.26 } 1.27 1.28 - void m1a() { 1.29 + void m1b() { 1.30 try { 1.31 throw new java.io.IOException(); 1.32 } 1.33 @@ -28,11 +28,20 @@ 1.34 catch(java.io.IOException exc) { } //ok 1.35 } 1.36 1.37 - void m2() { 1.38 + void m1c() { 1.39 try { 1.40 - nothing(); 1.41 + throw new java.io.FileNotFoundException(); 1.42 } 1.43 - catch(Exception exc) { } // ok 1.44 + catch(java.io.FileNotFoundException exc) { } 1.45 + catch(Exception ex) { } //ok (Exception/Throwable always allowed) 1.46 + } 1.47 + 1.48 + void m1d() { 1.49 + try { 1.50 + throw new java.io.FileNotFoundException(); 1.51 + } 1.52 + catch(java.io.FileNotFoundException exc) { } 1.53 + catch(Throwable ex) { } //ok (Exception/Throwable always allowed) 1.54 } 1.55 1.56 void m3() { 1.57 @@ -131,7 +140,7 @@ 1.58 runtime(); 1.59 } 1.60 catch(RuntimeException exc) { } 1.61 - catch(Exception exc) { } //6: ok; latest: unreachable 1.62 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.63 } 1.64 1.65 void m17() { 1.66 @@ -139,7 +148,7 @@ 1.67 nothing(); 1.68 } 1.69 catch(RuntimeException exc) { } 1.70 - catch(Exception exc) { } //6: ok; latest: unreachable 1.71 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.72 } 1.73 1.74 void m18() { 1.75 @@ -148,7 +157,7 @@ 1.76 } 1.77 catch(RuntimeException exc) { } 1.78 catch(InterruptedException exc) { } 1.79 - catch(Exception exc) { } //6: ok; latest: unreachable 1.80 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.81 } 1.82 1.83 void m19() { 1.84 @@ -157,7 +166,7 @@ 1.85 } 1.86 catch(RuntimeException exc) { } 1.87 catch(InterruptedException exc) { } //never thrown in try 1.88 - catch(Exception exc) { } //6: ok; latest: unreachable 1.89 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.90 } 1.91 1.92 void m20() { 1.93 @@ -166,7 +175,7 @@ 1.94 } 1.95 catch(RuntimeException exc) { } 1.96 catch(InterruptedException exc) { } //never thrown in try 1.97 - catch(Exception exc) { } //6: ok; latest: unreachable 1.98 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.99 } 1.100 1.101 void m21() { 1.102 @@ -182,7 +191,7 @@ 1.103 runtime(); 1.104 } 1.105 catch(RuntimeException exc) { } 1.106 - catch(Exception exc) { } // 6: ok; latest: unreachable 1.107 + catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed) 1.108 } 1.109 1.110 void m23() { 1.111 @@ -190,7 +199,7 @@ 1.112 nothing(); 1.113 } 1.114 catch(RuntimeException exc) { } 1.115 - catch(Exception exc) { } // 6: ok; latest: unreachable 1.116 + catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed) 1.117 } 1.118 1.119 void m24() { 1.120 @@ -208,7 +217,7 @@ 1.121 } 1.122 catch(RuntimeException exc) { } 1.123 catch(Error exc) { } 1.124 - catch(Throwable exc) { } //6: ok; latest: unreachable 1.125 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.126 } 1.127 1.128 void m26() { 1.129 @@ -217,7 +226,7 @@ 1.130 } 1.131 catch(RuntimeException exc) { } 1.132 catch(Error exc) { } 1.133 - catch(Throwable exc) { } //6: ok; latest: unreachable 1.134 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.135 } 1.136 1.137 void m27() { 1.138 @@ -227,7 +236,7 @@ 1.139 catch(RuntimeException exc) { } 1.140 catch(Error exc) { } 1.141 catch(InterruptedException exc) { } 1.142 - catch(Throwable exc) { } //6: ok; latest: unreachable 1.143 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.144 } 1.145 1.146 void m28() { 1.147 @@ -237,7 +246,7 @@ 1.148 catch(RuntimeException exc) { } 1.149 catch(Error exc) { } 1.150 catch(InterruptedException exc) { } //never thrown in try 1.151 - catch(Throwable exc) { } //6: ok; latest: unreachable 1.152 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.153 } 1.154 1.155 void m29() { 1.156 @@ -247,7 +256,7 @@ 1.157 catch(RuntimeException exc) { } 1.158 catch(Error exc) { } 1.159 catch(InterruptedException exc) { } //never thrown in try 1.160 - catch(Throwable exc) { } //6: ok; latest: unreachable 1.161 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.162 } 1.163 1.164 void m30() { 1.165 @@ -265,7 +274,7 @@ 1.166 } 1.167 catch(RuntimeException exc) { } 1.168 catch(Error exc) { } 1.169 - catch(Throwable exc) { } //6: ok; latest: unreachable 1.170 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.171 } 1.172 1.173 void m32() { 1.174 @@ -274,7 +283,7 @@ 1.175 } 1.176 catch(RuntimeException exc) { } 1.177 catch(Error exc) { } 1.178 - catch(Throwable exc) { } //6: ok; latest: unreachable 1.179 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 1.180 } 1.181 1.182 void m33() {