Assume the following API:
package nashorn.test;
public class API {
public static void test(String string) {
throw new RuntimeException(\"Don\'t
These are valid workarounds:
test(Integer[]) method using an array argument:var API = Java.type("nashorn.test.API");
API.test([1]);
public class AlternativeAPI1 {
public static void test(Integer... args) {
System.out.println("OK");
}
}
public class AlternativeAPI3 {
public static void test(String string) {
throw new RuntimeException("Don't call this");
}
public static void test(Integer args) {
System.out.println("OK");
}
}
String by CharSequence (or any other "similar type"):public class AlternativeAPI2 {
public static void test(CharSequence string) {
throw new RuntimeException("Don't call this");
}
public static void test(Integer args) {
System.out.println("OK");
}
}