jdaugherty commented on PR #3086:
URL: https://github.com/apache/groovy/pull/3086#issuecomment-6929761783

   @blackdrag Thanks for working through the Hibernate proxy rules and the 
closure and trait cases. I pushed 049e02fd57, which adds a "Metaclass shared 
with another class" section to the metaprogramming guide, after 
`ExpandoMetaClass`, backed by a spec test in `ExpandoMetaClassTest`. It 
documents only what this PR restores:
   
   - the receiver must be an instance of the class the metaclass belongs to, 
usually a subclass that stands in for it;
   - method calls and property access select that class's methods and 
properties, including those added to its metaclass at runtime, and an override 
in the receiver's class runs when one of them is selected;
   - a change to the metaclass applies to later calls on the receiver.
   
   It says that what the metaclass answers for members only the receiver's 
class has is not specified: methods and properties only the subclass declares, 
`super` calls in the subclass, private members and fields, and the members that 
closures and trait methods resolve. Your closure and trait examples, and the 
4.0 fallback from my last comment, are all in that group. Defining them would 
be the new feature you describe, so I'd leave that to its own issue rather than 
document today's `MissingMethodException` here.
   
   The example calls the same site before and after replacing the method, so it 
fails on a build without this fix.
   
   @daniellansun The three items from your Nov 8 review went into 08b2089eec a 
few minutes after it, as described in my reply to Paul above: the cold-tier 
wrapper carries and checks the metaclass owner's `SwitchPoint`; the test covers 
the real method called first and then replaced, with the cold tier off and on 
(in a fresh JVM), the registry-answering proxy, and `DelegatingMetaClass` as a 
control; and the table has every cell filled. 049e02fd57 only adds the 
documentation. Could you take another look?
   
   The 6.0.x backport branch 
[`GROOVY-12558-6_0_X`](https://github.com/jdaugherty/groovy/tree/GROOVY-12558-6_0_X)
 has the same commit (4f2c9dc7ac).
   


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