We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hey, I'm playing around with GraalVM/Graaljs and I stumbled upon an issue. Snippet first:
class Application { public static void main(String[] args) { String script = "console.log(phone.number)"; String script2 = "phone.call('Somebody')"; Phone phone = new Phone(); Context context = Context.create("js"); context.getBindings("js").putMember("phone", phone); runScript(script, context); runScript(script2, context); } private static Value runScript(String script, Context context) { return context.eval("js", script); } } class Phone { public int number = 123; public void call(String name) { System.out.println("Calling...: " + name); } }
When I execute the main method, that's what I'm getting:
In my pom.xml, there's graal-sdk included.
The text was updated successfully, but these errors were encountered:
Note that your snippet will work when you make your Phone class public. I will let others comment on whether this behaviour is a bug or an intention.
Phone
public
Sorry, something went wrong.
Thank you @iamstolis. I missed that. Going to leave it open though because as you said - it may be not intended.
It's intentional (and afaik in line with Nashorn). While the Application class has access to Phone's members, the engine has not.
woess
No branches or pull requests
Hey,
I'm playing around with GraalVM/Graaljs and I stumbled upon an issue. Snippet first:
When I execute the main method, that's what I'm getting:
In my pom.xml, there's graal-sdk included.
The text was updated successfully, but these errors were encountered: