Print this page


Split Close
Expand all
Collapse all
          --- old/test/java/util/concurrent/Executors/Throws.java
          +++ new/test/java/util/concurrent/Executors/Throws.java
↓ open down ↓ 114 lines elided ↑ open up ↑
 115  115      static void fail(String msg) {System.out.println(msg); fail();}
 116  116      static void unexpected(Throwable t) {failed++; t.printStackTrace();}
 117  117      static void check(boolean cond) {if (cond) pass(); else fail();}
 118  118      static void equal(Object x, Object y) {
 119  119          if (x == null ? y == null : x.equals(y)) pass();
 120  120          else fail(x + " not equal to " + y);}
 121  121      public static void main(String[] args) throws Throwable {
 122  122          try {realMain(args);} catch (Throwable t) {unexpected(t);}
 123  123          System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
 124  124          if (failed > 0) throw new AssertionError("Some tests failed");}
 125      -    private static abstract class Fun {abstract void f() throws Throwable;}
      125 +    private abstract static class Fun {abstract void f() throws Throwable;}
 126  126      static void THROWS(Class<? extends Throwable> k, Fun... fs) {
 127  127          for (Fun f : fs)
 128  128              try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
 129  129              catch (Throwable t) {
 130  130                  if (k.isAssignableFrom(t.getClass())) pass();
 131  131                  else unexpected(t);}}
 132  132  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX