MCPcopy Index your code
hub / github.com/beanshell/beanshell / invokeCompiledCommand

Method invokeCompiledCommand

src/bsh/Reflect.java:838–852  ·  view source on GitHub ↗

A command may be implemented as a compiled Java class containing one or more static invoke() methods of the correct signature. The invoke() methods must accept two additional leading arguments of the interpreter and callstack, respectively. e.g. invoke(interpreter, callstack, ... ) This method adds

(Class commandClass, Object[] args, Interpreter interpreter, CallStack callstack)

Source from the content-addressed store, hash-verified

836 * the result.
837 */
838 public static Object invokeCompiledCommand(Class commandClass, Object[] args, Interpreter interpreter, CallStack callstack) throws UtilEvalError {
839 // add interpereter and namespace to args list
840 Object[] invokeArgs = new Object[args.length + 2];
841 invokeArgs[0] = interpreter;
842 invokeArgs[1] = callstack;
843 System.arraycopy(args, 0, invokeArgs, 2, args.length);
844 BshClassManager bcm = interpreter.getClassManager();
845 try {
846 return Reflect.invokeStaticMethod(bcm, commandClass, "invoke", invokeArgs);
847 } catch (InvocationTargetException e) {
848 throw new UtilEvalError("Error in compiled command: " + e.getTargetException(), e);
849 } catch (ReflectError e) {
850 throw new UtilEvalError("Error invoking compiled command: " + e, e);
851 }
852 }
853
854
855 private static void logInvokeMethod(String msg, Method method, Object[] args) {

Callers 1

invokeLocalMethodMethod · 0.95

Calls 2

invokeStaticMethodMethod · 0.95
getClassManagerMethod · 0.45

Tested by

no test coverage detected