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

how can i pass java object in javascript and create new object in javascript? #585

Open
xjl2020 opened this issue Oct 8, 2022 · 0 comments

Comments

@xjl2020
Copy link

xjl2020 commented Oct 8, 2022

use j2v8 in android:
class A{
public C methodA1(B b) {
return b.methodB1();
}

public B methodA2() {
	return new B();
}

}

class B{

public C methodB1(){
	return new C();
}

}

class C{
public void methodC1(){

}

}

then,what should i do to resolve this, i use registerJavaMethod but it report error like this:

Unknown return type: class

if use V8JavaAdapter.injectclass then can create new object like:
let b1 = new B();

and in java:

v8 = V8.createV8Runtime();
V8Object v8Console = new V8Object(v8);
v8.add('A',v8Console);
v8Console.registerJavaMethod(value, method.getName(), method.getName(), parameterTypes); -- register A methodA1
then i use A.methodA1(b1) it report error:
has argument 1 has type B, got com.eclipsesource.v8.V8Object,
how to resolve it , Thank you!!

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