Skip to content

Commit b351c2d

Browse files
committed
Let the bindings accept the current ScriptModule instance
We recently improved the Scripting engine to accomodate the needs of the ImageJ 1.x macro engine with regards to @parameter annotations. The major change was that the current ScriptModule instance is made available to the engine bindings. However, the Java script engine is a slightly different beast and needs to make sure that no unexpected bindings are set (because they cannot be used by the 'script'). Let's play nice and just ignore the binding. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 373a04f commit b351c2d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
import javax.script.Bindings;
4040
import javax.script.ScriptEngine;
4141

42+
import org.scijava.script.ScriptModule;
43+
4244
/**
4345
* TODO
4446
*
@@ -85,7 +87,8 @@ public Set<Entry<String, Object>> entrySet() {
8587

8688
@Override
8789
public Object put(String name, Object value) {
88-
if (!name.equals(ScriptEngine.FILENAME) && !name.equals("IJ")) {
90+
if (!name.equals(ScriptEngine.FILENAME) && !name.equals("IJ") &&
91+
!name.equals(ScriptModule.class.getName())) {
8992
throw new UnsupportedOperationException();
9093
}
9194
return map.put(name, value);

0 commit comments

Comments
 (0)