Skip to content

Trouble clearing bindings with RenjinBindings.clear() #560

@winfrees

Description

@winfrees

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")));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions