Skip to content

Commit

Permalink
Merge pull request #158 from ernesto-castelan/fix-proxy-classes
Browse files Browse the repository at this point in the history
Add public modifier to proxy related classes to fix IllegalAccessError
  • Loading branch information
puneetbehl authored Nov 28, 2023
2 parents 509a2d2 + db4bf5a commit 1686245
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
* @author Graeme Rocher
* @since 6.1.2
*/
class HibernateGroovyObjectMethodHandler extends EntityProxyMethodHandler {
public class HibernateGroovyObjectMethodHandler extends EntityProxyMethodHandler {
private Object target;
private final Object originalSelf;
private final LazyInitializer lazyInitializer;

HibernateGroovyObjectMethodHandler(Class<?> proxyClass, Object originalSelf, LazyInitializer lazyInitializer) {
public HibernateGroovyObjectMethodHandler(Class<?> proxyClass, Object originalSelf, LazyInitializer lazyInitializer) {
super(proxyClass);
this.originalSelf = originalSelf;
this.lazyInitializer = lazyInitializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ProxyFactorySupport {
// first make the lazy initializer
String initializerName = "${ProxyFactorySupport.package.name}.GroovyAwareJavassistLazyInitializer"
CtClass initializerSuperClass = getClassFromPool(pool, BasicLazyInitializer.name)
pool.getOrNull(initializerName)?.defrost()
CtClass initializerClass = pool.makeClass(initializerName, initializerSuperClass)
initializerClass.addInterface(getClassFromPool(pool, MethodHandler.name))

Expand Down Expand Up @@ -151,6 +152,7 @@ class ProxyFactorySupport {
// now make the proxy factory
String factoryName = "${ProxyFactorySupport.package.name}.GroovyAwareJavassistProxyFactory"
CtClass factorySuperClass = getClassFromPool(pool, AbstractGroovyAwareJavassistProxyFactory.name)
pool.getOrNull(factoryName)?.defrost()
CtClass factorCls = pool.makeClass(factoryName, factorySuperClass)

CtMethod getProxyMethod = factorySuperClass.getMethods().find { CtMethod m -> m.name == 'getProxy' }
Expand Down

0 comments on commit 1686245

Please sign in to comment.