borinquenkid commented on PR #16625:
URL: https://github.com/apache/grails-core/pull/16625#issuecomment-6137197051

   Thanks for the contribution, @MartinJesusDev. The `getMetaClass()` wrapper 
is the right fix for #16600, and I built on it.
   
   I pushed one commit to your branch (`776c6d948c`). It keeps your approach 
and changes these things:
   
   - **CI fix.** The wrapper declared no interfaces, so `Class#getInterfaces()` 
no longer listed `HibernateProxy`. `ProxyUtils.isProxy` in the ACL plugin looks 
there, so it stopped recognizing Groovy entity proxies, and `AclUtilServiceSpec 
> foo` failed. The wrapper now declares the stock proxy's interfaces.
   - **More robust.** The proxy class is generated and checked once, in 
`postInstantiate`. It must implement `ProxyConfiguration`, and the default 
constructor is looked up once and kept. If either is wrong, it fails at startup 
naming the entity, not on the first lazy load. `getProxy` no longer has a 
silent `instanceof` skip.
   - **Easier to test.** Generating the class moved into a small 
`GroovyProxyClassBuilder` in each module, with its own spec. The factory specs 
now use a real `ByteBuddyProxyHelper` and a real session instead of mocks.
   - **Hibernate 7.** The wrapper is loaded through the provider's 
`ByteBuddyState`, like the stock proxy class. Hibernate 5.6 gives no access to 
that state, so H5 still generates the wrapper with `ByteBuddy` directly.
   
   The full test suites of both modules pass locally (H5 1091 tests, H7 3625 
tests, 0 failures).
   


-- 
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