jdaugherty opened a new issue, #15290:
URL: https://github.com/apache/grails-core/issues/15290

   ### Issue description
   
   Researching https://issues.apache.org/jira/browse/GROOVY-11817 I discovered 
that switching to invokeDynamic and using @GrailsCompileStatic sometimes 
results in compile failures.  Eric from the groovy team summarized why this 
fails: 
   
       This fails because the makeDynamic call within the type checking 
extension affects the entire method. The normal path of book[0] is to fall 
through to BinaryExpressionHelper#evaluateBinaryExpression then into 
StaticTypesCallSiteWriter#makeSingleArgumentCall. The dynamic resolution causes 
it to go to IndyCallSiteWriter#makeSingleArgumentCall instead which just throws.
       If you isolate the dynamic stuff to its own method, the impact of 
dynamic resolution is minimized.
   
   
   Moreover, the Groovy Docs even reference the type checking extension in 
question 
(https://docs.groovy-lang.org/docs/groovy-4.0.0/html/documentation/#Typecheckingextensions-Virtualmethods).
  But the extension is not implemented like the Groovy docs suggest, instead 
it's implemented by making the call dynamic.  
   
   This ticket is to switch the dynamic finder extension to no longer use 
dynamic and instead use the newMethod technique mentioned in the Groovy docs.  
As a side effect, this will likely improve performance for any user of 
`@GrailsCompileStatic` & dynamic finders.  


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