1 32 package org.jruby.exceptions; 33 34 40 public class JumpException extends RuntimeException { 41 private static final long serialVersionUID = -228162532535826617L; 42 43 public static final class JumpType { 44 public static final int BREAK = 0; 45 public static final int NEXT = 1; 46 public static final int REDO = 2; 47 public static final int RETRY = 3; 48 public static final int RETURN = 4; 49 public static final int THROW = 5; 50 public static final int RAISE = 6; 51 52 public static final JumpType BreakJump = new JumpType(BREAK); 53 public static final JumpType NextJump = new JumpType(NEXT); 54 public static final JumpType RedoJump = new JumpType(REDO); 55 public static final JumpType RetryJump = new JumpType(RETRY); 56 public static final JumpType ReturnJump = new JumpType(RETURN); 57 public static final JumpType ThrowJump = new JumpType(THROW); 58 public static final JumpType RaiseJump = new JumpType(RAISE); 59 60 private final int typeId; 61 private JumpType(int typeId) { 62 this.typeId = typeId; 63 } 64 public int getTypeId() { 65 return typeId; 66 } 67 } 68 69 private JumpType jumpType; 70 private Object target; 71 private Object value; 72 73 private boolean inKernelLoop = false; 76 77 80 public JumpException(JumpType jumpType) { 81 super(); 82 this.jumpType = jumpType; 83 } 84 85 89 public JumpException(String msg, JumpType jumpType) { 90 super(msg); 91 this.jumpType = jumpType; 92 } 93 94 public JumpException(String msg, Throwable cause, JumpType jumpType) { 95 super(msg, cause); 96 this.jumpType = jumpType; 97 } 98 99 103 public Throwable fillInStackTrace() { 104 return this; 105 } 106 107 protected Throwable originalFillInStackTrace() { 108 return super.fillInStackTrace(); 109 } 110 111 public JumpType getJumpType() { 112 return jumpType; 113 } 114 115 118 public Object getTarget() { 119 return target; 120 } 121 122 125 public void setTarget(Object target) { 126 this.target = target; 127 } 128 129 134 public Object getValue() { 135 return value; 136 } 137 138 143 public void setValue(Object value) { 144 this.value = value; 145 } 146 147 148 public void setBreakInKernelLoop(boolean inKernelLoop) { 149 this.inKernelLoop = inKernelLoop; 150 } 151 152 public boolean isBreakInKernelLoop() { 153 return inKernelLoop; 154 } 155 } 156 | Popular Tags |