( Object proxy, Method method, Object[] args )
| 140 | class Handler implements InvocationHandler, java.io.Serializable |
| 141 | { |
| 142 | public Object invoke( Object proxy, Method method, Object[] args ) |
| 143 | throws Throwable |
| 144 | { |
| 145 | try { |
| 146 | return invokeImpl( proxy, method, args ); |
| 147 | } catch ( TargetError te ) { |
| 148 | // Unwrap target exception. If the interface declares that |
| 149 | // it throws the ex it will be delivered. If not it will be |
| 150 | // wrapped in an UndeclaredThrowable |
| 151 | |
| 152 | // This isn't simple because unwrapping this loses all context info. |
| 153 | // So rewrap is better than unwrap. - fschmidt |
| 154 | Throwable t = te.getTarget(); |
| 155 | Class<? extends Throwable> c = t.getClass(); |
| 156 | String msg = t.getMessage(); |
| 157 | try { |
| 158 | Throwable t2 = msg==null |
| 159 | ? c.getConstructor().newInstance() |
| 160 | : c.getConstructor(String.class).newInstance(msg) |
| 161 | ; |
| 162 | t2.initCause(te); |
| 163 | throw t2; |
| 164 | } catch(NoSuchMethodException e) { |
| 165 | throw t; |
| 166 | } |
| 167 | } catch ( EvalError ee ) { |
| 168 | // Ease debugging... |
| 169 | // XThis.this refers to the enclosing class instance |
| 170 | if ( Interpreter.DEBUG ) |
| 171 | Interpreter.debug( "EvalError in scripted interface: " |
| 172 | + This.this.toString() + ": "+ ee ); |
| 173 | throw ee; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | public Object invokeImpl( Object proxy, Method method, Object[] args ) |
| 178 | throws EvalError |
nothing calls this directly
no test coverage detected