Skip to content

Commit

Permalink
Fixed class loading bug with proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
beikov committed Jul 22, 2014
1 parent bcb2d1b commit f343556
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import javassist.CannotCompileException;
import javassist.ClassClassPath;
import javassist.ClassPath;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtConstructor;
Expand Down Expand Up @@ -73,6 +75,9 @@ private static <T> Class<? extends T> createProxyClass(ViewType<T> viewType) {
CtClass cc = pool.makeClass(clazz.getName() + "_$$_javassist_entityview_" + classCounter.getAndIncrement());
CtClass superCc;

ClassPath classPath = new ClassClassPath(clazz);
pool.insertClassPath(classPath);

try {
superCc = pool.get(clazz.getName());

Expand Down Expand Up @@ -157,6 +162,8 @@ private static <T> Class<? extends T> createProxyClass(ViewType<T> viewType) {
return cc.toClass();
} catch (Exception ex) {
throw new RuntimeException("Probably we did something wrong, please contact us if you see this message.", ex);
} finally {
pool.removeClassPath(classPath);
}
}

Expand Down

0 comments on commit f343556

Please sign in to comment.