Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with static methods in javascript to java linker(v8JavaStaticMethodProxy) #22

Open
JamesSmall opened this issue Jul 27, 2018 · 0 comments

Comments

@JamesSmall
Copy link

here is an expected error message

undefined:1: Wrong number of arguments; expected 2*, got 0

*any number for a method with more params than 0.

the cause is at line 45 of V8JavaStaticMethodProxy with the following statement.
return V8JavaObjectUtils.translateJavaArgumentToJavascript(coercedMethod.invoke(coercedArguments), V8JavaObjectUtils.getRuntimeSarcastically(receiver), cache);

to be specific, coercedMethod.invoke(coercedArguments) is improper call for a static method.

the following coercedMethod.invoke(null,coercedArguments) I suspect will have the desired effect for static methods with parameters.

with Method.invoke, the first parameter is a live (non static) object of a class, if it is null, it will default to a static methods only of said class. the second parameter(or v varargs if you rather call it) is all the passed variables for the method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant