code: @Override
      public Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException {
          if (!(thiz instanceof bsh.This)) {
              throw new ScriptException("Illegal object type: " + (null == thiz ? "null" : thiz.getClass()));
          }
  
          bsh.This bshObject = (bsh.This) thiz;
  
          try {
              return bshObject.invokeMethod(name, args);
          } catch (TargetError e) {
              // The script threw an application level exception
              // set it as the cause ?
              ScriptException se = new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber());
              se.initCause(e.getTarget());
              throw se;
          } catch (EvalError e) {
              // The script couldn't be evaluated properly
              throw new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber());
          }
      }
docs: Calls a procedure compiled during a previous script execution, which is
  retained in the state of the {@code ScriptEngine{@code .
  
  @param name The name of the procedure to be called.
  @param thiz If the procedure is a member  of a class defined in the script
  and thiz is an instance of that class returned by a previous execution or
  invocation, the named method is called through that instance. If classes are
  not supported in the scripting language or if the procedure is not a member
  function of any class, the argument must be {@code null}.
  @param args Arguments to pass to the procedure.  The rules for converting
  the arguments to scripting variables are implementation-specific.
  @return The value returned by the procedure.  The rules for converting the
  scripting variable returned by the procedure to a Java Object are
  implementation-specific.
  @throws javax.script.ScriptException if an error occurrs during invocation
  of the method.
  @throws NoSuchMethodException        if method with given name or matching argument
  types cannot be found.
  @throws NullPointerException      if method name is null.