Skip to content

Commit f29650e

Browse files
committed
DefaultScriptService: do not wrap JSR-223 engines
In theory, it was nice to try to expose all available JSR-223 ScriptEngineFactory implementations as SciJava script languages. However, without an associated explicit ScriptLanguage plugin, there are limitations to what the SciJava framework can achieve. And there was related behavior which could be construed as a bug: each SciJava scripting component now exposes its ScriptLanguage as a ScriptEngineFactory via the javax.services mechanism so that it can be used from other JSR-223 applications not built on SJC. This caused them to be discovered and added to the ScriptLanguageIndex twice: once as ScriptLanguage plugins directly, and again as wrapped JSR-223 ScriptEngineFactory implementations. While we could make the ScriptService smarter about this situation, it is easier to simply stop wrapping vanilla JSR-223 ScriptEngineFactory classes, because we have no use cases relying on it. (The only engine I know of which has no associated SciJava scripting component is AppleScript on OS X, and AFAIK, no one writes AppleScript scripts in anger in ImageJ.)
1 parent 2633490 commit f29650e

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

src/main/java/org/scijava/script/DefaultScriptService.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -346,20 +346,6 @@ private synchronized void initScriptLanguageIndex() {
346346
index.add(language, true);
347347
}
348348

349-
// Now look for the ScriptEngines in javax.scripting. We only do that
350-
// now since the javax.scripting framework does not provide all the
351-
// functionality we might want to use in a SciJava application.
352-
final ScriptEngineManager manager = new ScriptEngineManager();
353-
for (final ScriptEngineFactory factory : manager.getEngineFactories()) {
354-
index.add(factory, true);
355-
}
356-
357-
// Inject the context into languages which need it: the
358-
// wrapped engine factories from the ScriptEngineManager.
359-
for (final ScriptLanguage language : index) {
360-
if (language.getContext() == null) language.setContext(getContext());
361-
}
362-
363349
scriptLanguageIndex = index;
364350
}
365351

0 commit comments

Comments
 (0)