1 package test; 2 3 public class MethodFallThroughExitPoints { 4 5 public void simpleFallThroughExitPoint() { 6 } 7 8 public void fallThroughExitPointWithIf() { 9 if (Boolean.getBoolean("")) 10 return; 11 } 12 13 public void notFallThroughIfWithElse() { 14 if (Boolean.getBoolean("")) 15 return; 16 else 17 return; 18 } 19 20 public void fallThroughExitPointWithTryCatch() { 21 try { 22 return; 23 } catch (RuntimeException t) { 24 return; 25 } catch (Error t) { 26 } 27 } 28 29 public void notFallThroughTryCatchWithReturns() { 30 try { 31 return; 32 } catch (RuntimeException t) { 33 return; 34 } catch (Error t) { 35 return; 36 } 37 } 38 39 public void notFallThroughFinallyWithReturn() { 40 try { 41 } catch (Throwable t) { 42 } finally { 43 return ; 44 } 45 } 46 47 public void notFallThroughThrow() { 48 throw new IllegalStateException (); 49 } 50 51 } 52 | Popular Tags |