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

Trouble clearing bindings with RenjinBindings.clear() #560

Open
winfrees opened this issue Jul 6, 2022 · 0 comments
Open

Trouble clearing bindings with RenjinBindings.clear() #560

winfrees opened this issue Jul 6, 2022 · 0 comments

Comments

@winfrees
Copy link

winfrees commented Jul 6, 2022

In trying to move SciJava to v 3.5-beta76 (from 0.9) one of our unit tests is failing with an assertNull after RenjinBindings.clear(). Based on Renjin source everything looks correct. Furthermore, both javax.script.ScriptEngine.put() and javax.script.ScriptEngine.remove() behave predictably. Any insight would be appreciated, thanks.

	final Context context = new Context(ScriptService.class);
	final ScriptService scriptService = context.getService(ScriptService.class);
	final ScriptLanguage language = scriptService.getLanguageByExtension("r");
            final ScriptEngine engine = language.getScriptEngine();

	assertEquals(RenjinScriptEngine.class, engine.getClass());

	engine.put("hello", 17);
	assertEquals(17, RenjinUtils.getJavaValue((SEXP) engine.eval("hello")));
	assertEquals(17, RenjinUtils.getJavaValue((SEXP) engine.get("hello")));

	RenjinBindings bindings = (RenjinBindings)engine.getBindings(ScriptContext.ENGINE_SCOPE);
           
            bindings.clear();

            System.out.println("Binding 2:" + bindings.get("hello"));
           
	assertNull(RenjinUtils.getJavaValue((SEXP) engine.get("hello")));
	assertNull(RenjinUtils.getJavaValue((SEXP) engine.get("polar_kraken")));
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