public void setMethod( BshMethod method ) throws UtilEvalError { super.setMethod( method ); }
public void setMethod(BshMethod method) throws UtilEvalError { getParent().setMethod( method ); } }
public void setMethod(BshMethod method) { getParent().setMethod( method ); } }
for (BshMethod mtd : _mtds) { try { _bshns.setMethod(mtd.getName(), mtd); } catch (Throwable ex) { log.warn("Ignored failure of set " + mtd, ex);
Fields.setAccessible(f, acs); ns.setMethod(mtd.getName(), mtd); } catch (IOException ex) { throw ex;
/** Wrap super constructor as a BshMethod. * @param name constructor name * @param con the super constructor * @param declaringNameSpace the name space */ DelayedEvalBshMethod(String name, Invocable con, NameSpace declaringNameSpace) { this(name, con.getReturnTypeDescriptor(), null, new String[con.getParameterCount()], con.getParamTypeDescriptors(), null, new BSHBlock(0), declaringNameSpace, null, null, null); this.constructor = con; this.getModifiers().addModifier("public"); this.getParameterModifiers(); declaringNameSpace.setMethod(this); this.constructorArgs = This.CONTEXT_ARGS.get().remove(name); }
/** Evaluate the declaration of the method. That is, determine the structure of the method and install it into the caller's namespace. */ public Object eval( CallStack callstack, Interpreter interpreter ) throws EvalError { returnType = evalReturnType( callstack, interpreter ); evalNodes( callstack, interpreter ); // Install an *instance* of this method in the namespace. // See notes in BshMethod // This is not good... // need a way to update eval without re-installing... // so that we can re-eval params, etc. when classloader changes // look into this NameSpace namespace = callstack.top(); BshMethod bshMethod = new BshMethod( this, namespace, modifiers ); namespace.setMethod( bshMethod ); return Primitive.VOID; }
@Override public Object visit(BSHMethodDeclaration node) { node.returnType = evalMethodReturnType(node); evalNodes(node); // Install an *instance* of this method in the namespace. // See notes in BshMethod // This is not good... // need a way to update eval without re-installing... // so that we can re-eval params, etc. when classloader changes // look into this NameSpace namespace = callstack.top(); BshMethod bshMethod = new BshMethod( node, namespace, node.modifiers ); try { namespace.setMethod( bshMethod ); } catch ( UtilEvalError e ) { throw e.toEvalError(node,callstack); } return Primitive.VOID; }
/** This is the invocation handler for the dynamic proxy. <p> Notes: Inner class for the invocation handler seems to shield this unavailable interface from JDK1.2 VM... I don't understand this. JThis works just fine even if those classes aren't there (doesn't it?) This class shouldn't be loaded if an XThis isn't instantiated in NameSpace.java, should it? */ class Handler implements InvocationHandler, java.io.Serializable { public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return invokeImpl( proxy, method, args ); } catch ( TargetError te ) { // Unwrap target exception. If the interface declares that // it throws the ex it will be delivered. If not it will be // wrapped in an UndeclaredThrowable // This isn't simple because unwrapping this loses all context info. // So rewrap is better than unwrap. - fschmidt Throwable t = te.getTarget(); Class<? extends Throwable> c = t.getClass(); String msg = t.getMessage(); try {
ns.setMethod(method);
namespace.setMethod( (BshMethod) obj ); return Primitive.VOID;