Unexpected Object Type Returned When Using GraalVM in Java

48 Views Asked by At

I'm currently working with GraalVM in Java and encountering an issue with the object type returned by a function. Here's the code snippet:

import com.oracle.truffle.js.scriptengine.GraalJSScriptEngine;
import org.graalvm.polyglot.HostAccess;
import org.graalvm.polyglot.Value;

myRunFunction(myOwnObject input) {
    myOwnProxyObject finalInput = new myOwnProxyObject(input);
    Object result;
    try {
        result = Engine.invokeFunction(myJSCode, finalInput, context, logger, data, anotherData);
    } catch(Exception e){
        //do something
    }

//do other
}

The problem is that the result object is of type polygloMtap instead of the expected myOwnProxyObject. Can anyone help me understand why this is happening and how I can ensure the function returns an object of type myOwnProxyObject? Any help would be greatly appreciated.

Here's what I've attempted so far: Initially, I was working with the object type myOwnObject. However, after conducting some research, I realized that this approach might not be the most efficient. Despite this, I still received an object of type myOwnObject. This led me to suspect that there might be an issue with the implementation of myOwnProxyObject. However, I'm currently unsure of what the specific problem could be. I'm looking for guidance on what could potentially be wrong with my myOwnProxyObject implementation.

0

There are 0 best solutions below