eclipsesource / eclipsesource/J2V8

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

Open
#585 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.6k
Forks
387
PR merge metrics
No merged PRs in 30d

Description

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!!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.