Skip to content

Commit 4d7ba4f

Browse files
authored
fix: groovy class loader issue (#39)
1 parent 98b557d commit 4d7ba4f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/main/java/w/core/ExecBundle.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public Class<?> loadClass(String name) throws ClassNotFoundException {
7171
if (!name.equals(EXEC_CLASS)) {
7272
return super.loadClass(name);
7373
}
74-
FileInputStream f;
7574
try {
7675
byte[] bytes = WCompiler.compileWholeClass("package w; public class Exec { public void exec() {} }");
7776
return defineClass(EXEC_CLASS, bytes, 0, bytes.length);

src/main/java/w/core/GroovyBundle.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ public WGroovyClassLoader(ClassLoader delegate) throws Exception {
116116
}
117117
@Override
118118
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
119+
if (name.startsWith("w.") && !name.equals(GroovyBundle.class.getName())) {
120+
return delegate.loadClass(name);
121+
}
119122
try {
120123
Class<?> c = findLoadedClass(name);
121124
if (c != null) return c;

0 commit comments

Comments
 (0)