/** * This method provides a hook for the class generator implementation to * store additional information in the class's bsh static namespace. * Currently this is used to store an array of consructors corresponding * to the constructor switch in the generated class. * * This method must be called to initialize the static space even if we * are using a previously generated class. */ public void initStaticNameSpace(NameSpace classStaticNameSpace, BSHBlock instanceInitBlock) { try { classStaticNameSpace.setLocalVariable(""+BSHCLASSMODIFIERS, classModifiers, false/*strict*/); classStaticNameSpace.setLocalVariable(""+BSHCONSTRUCTORS, constructors, false/*strict*/); classStaticNameSpace.setLocalVariable(""+BSHINIT, instanceInitBlock, false/*strict*/); } catch (UtilEvalError e) { throw new InterpreterError("Unable to init class static block: " + e, e); } }
classStaticNameSpace.setLocalVariable(BSHCONSTRUCTORS, constructors, false/*strict*/); } catch (UtilEvalError e) { throw new InterpreterError("can't set cons var");
nameSpace.setLocalVariable( varName, val, strictJava ); else nameSpace.setVariable( varName, val, strictJava );
/** 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 {
try { for( String varName : namespace.getVariableNames() ) { ns.setLocalVariable(varName,namespace.getVariable(varName,false),false);
classStaticNameSpace.setLocalVariable(ClassGeneratorUtil.BSHINIT, block, false/*strictJava*/); } catch (UtilEvalError e) { throw new InterpreterError("unable to init static: " + e);
+ name, callerInfo, callstack ); else try { localNameSpace.setLocalVariable( paramNames[k], argValues[i], interpreter.getStrictJava() );
else try { localNameSpace.setLocalVariable( paramNames[i], argValues[i], visitor.getInterpreter().getStrictJava() );