Skip to content

Commit 06d8ee7

Browse files
committed
JavaEngine: avoid setting classloader
If a ClassLoader sticks around it will prevent future versions of classes from being loaded. There is no evidence that preserving the ClassLoader is actually necessary for annotation processing at this time.
1 parent 91e2d86 commit 06d8ee7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,9 @@ public Class<?> compile(String script) throws ScriptException {
222222
for (int i = 0; i < urls.length; i++)
223223
urls[i] =
224224
new URL("file:" + paths[i] + (paths[i].endsWith(".jar") ? "" : "/"));
225-
URLClassLoader classLoader =
226-
new URLClassLoader(urls, Thread.currentThread()
227-
.getContextClassLoader());
228225

229-
// needed for annotation processing
230-
Thread.currentThread().setContextClassLoader(classLoader);
226+
final URLClassLoader classLoader = new URLClassLoader(urls, Thread.currentThread()
227+
.getContextClassLoader());
231228

232229
// load main class
233230
return classLoader.loadClass(mainClass);

0 commit comments

Comments
 (0)