code: public Object apply (
          String source, int lineNo, int columnNo, Object funcBody,
          Vector namesVec, Vector argsVec )
         throws BSFException
      {
          if ( namesVec.size() != argsVec.size() )
              throw new BSFException("number of params/names mismatch");
          if ( !(funcBody instanceof String) )
              throw new BSFException("apply: functino body must be a string");
  
          String [] names = new String [ namesVec.size() ];
          namesVec.copyInto(names);
          Object [] args = new Object [ argsVec.size() ];
          argsVec.copyInto(args);
  
          try
          {
              if ( !installedApplyMethod )
              {
                  interpreter.eval( bsfApplyMethod );
                  installedApplyMethod = true;
              }
  
              bsh.This global = (bsh.This)interpreter.get("global");
              Object value = global.invokeMethod(
                  "_bsfApply", new Object [] { names, args, (String)funcBody } );
              return Primitive.unwrap( value );
  
          } catch ( InterpreterError e )
          {
              throw new BSFException(BSFException.REASON_UNKNOWN_LANGUAGE,
                  "BeanShell interpreter internal error: "+e
                  + sourceInfo(source,lineNo,columnNo), e);
          } catch ( TargetError e2 )
          {
              throw new BSFException(BSFException.REASON_EXECUTION_ERROR,
                  "The application script threw an exception: "
                  + e2.getTarget()
                  + sourceInfo(source,lineNo,columnNo), e2);
          } catch ( EvalError e3 )
          {
              throw new BSFException(BSFException.REASON_OTHER_ERROR,
                  "BeanShell script error: "+e3
                  + sourceInfo(source,lineNo,columnNo), e3);
          }
      }
docs: /*
  Note: the apply() method may be supported directly in BeanShell in an
  upcoming release and would not require special support here.