codeconsole opened a new pull request, #3104:
URL: https://github.com/apache/groovy/pull/3104

   When a closure body calls a method the closure inherits, such as 
`toString()` or `with`, `tap` or `identity`, and neither the delegate nor the 
owner can take it, the closure's own method now runs once and its result is 
returned. This happens, for example, with `OWNER_ONLY` after `rehydrate(null, 
null, null)`, or with `DELEGATE_ONLY` and no delegate.
   
   `ClosureMetaClass` invoked that fallback, discarded the result and threw 
`MissingMethodException`. Called from compiled code, invokedynamic caught the 
exception and called the method again through `GroovyObject.invokeMethod`, so 
`{ -> int n = 0; with { n++ }; n }` gave 2 there. Called through the meta class 
directly, the call threw `MissingMethodException` after running the method.
   
   Tests: 
`ClosureDelegationTest.testClosureMethodWhenNeitherDelegateNorOwnerHasIt`, 
which fails without the change. The `groovy`, `gls`, `bugs` and 
`org.codehaus.groovy` packages pass (15,496 tests). The Checkstyle and CodeNarc 
gates pass.
   
   A regression in 6.0.0: 4.0.33 and 5.0.8 give 1.
   


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