Multi-catch support: more highlighting

This commit is contained in:
Roman Shevchenko
2011-02-19 14:48:11 +01:00
parent 85f277a149
commit f2184f3f50
6 changed files with 52 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ abstract class C {
private static class E1 extends E { }
private static class E2 extends E { }
private static class E3 extends E { }
private static class E4 extends E { }
private static class RE extends RuntimeException { }
private interface I<T> { }
private static class IE1 extends E implements I<Integer> { }
@@ -23,7 +24,7 @@ abstract class C {
try { g(); } catch (IE1 | IE2 e) { new F<I<? extends Number>>(e); }
try { f(); } catch (E1 | E2 | <error descr="Exception 'C.E3' is never thrown in the corresponding try block">E3</error> e) { }
try { f(); } catch (<error descr="Exception 'C.E3' is never thrown in the corresponding try block">E3</error> | E e) { }
try { f(); } catch (<error descr="Exception 'C.E3' is never thrown in the corresponding try block">E3</error> | <error descr="Exception 'C.E4' is never thrown in the corresponding try block">E4</error> | E e) { }
try { f(); } catch (E | <error descr="Exception 'C.E1' has already been caught">E1</error> e) { }
try { f(); } catch (E | <error descr="Exception 'C.E3' has already been caught">E3</error> e) { }

View File

@@ -0,0 +1,12 @@
abstract class C {
private static class E extends Exception { }
private static class E1 extends E { }
private static class E2 extends E { }
abstract void f() throws E1, E2;
void m() {
try { f(); } catch (E1 | E2 ignore) { }
try { f(); } catch (<warning descr="Exception 'C.E1' is also caught by 'C.E'">E1</warning> | E ignore) { }
}
}