How to pass types and functions to a JSR-223 script?
问题 A typical JSR-223 script would begin with a series of surrogate imports like this (JavaScript+Nashorn chosen for example purposes): // "import" classes and static methods var Foo = Java.type("my.package.Foo"); // application classes require Java.type() use var bar = Foo.bar; // static method var Logger = java.util.logging.Logger; // system classes can be accessed directly var sin = java.lang.Math.sin; // the same for static methods // use them var foo = new Foo(); print(bar()); var log =