jamesfredley commented on code in PR #15548:
URL: https://github.com/apache/grails-core/pull/15548#discussion_r3029199336


##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/proxy/HibernateProxyHandler.java:
##########
@@ -58,6 +58,11 @@ public boolean isInitialized(Object o) {
             return li.wasInitialized();
         }
 
+        Boolean groovyProxyInit = GroovyProxyInterceptorLogic.isInitialized(o);
+        if (groovyProxyInit != null) {
+            return groovyProxyInit;

Review Comment:
   Good catch - renamed to `groovyProxyInitialized` in 148d718.



##########
grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/proxy/HibernateProxyHandler7Spec.groovy:
##########
@@ -145,6 +145,23 @@ class HibernateProxyHandler7Spec extends 
HibernateGormDatastoreSpec {
         proxyHandler.isInitialized(location)
     }
 
+    void "test isInitialized for a Groovy proxy before initialization"() {
+        given:
+        def originalFactory = manager.session.mappingContext.proxyFactory
+        manager.session.mappingContext.proxyFactory = new GroovyProxyFactory()
+        Location location = new Location(name: "Test Location").save(flush: 
true)
+        manager.session.clear()
+        manager.hibernateSession.clear()
+
+        Location proxyLocation = Location.proxy(location.id)
+
+        expect:
+        !proxyHandler.isInitialized(proxyLocation)

Review Comment:
   Agreed - added a `proxyLocation.metaClass instanceof ProxyInstanceMetaClass` 
precondition assertion so the test explicitly validates the Groovy-proxy code 
path. Fixed in 148d718.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to