[ 
https://issues.apache.org/jira/browse/GROOVY-12140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18094465#comment-18094465
 ] 

ASF GitHub Bot commented on GROOVY-12140:
-----------------------------------------

paulk-asert opened a new pull request, #2676:
URL: https://github.com/apache/groovy/pull/2676

   …valueOf
   
   Method#invoke boxes primitive return values with fresh instances, unlike 
MethodHandle-based and generated-bytecode invocation, which box through the 
valueOf caches. Dispatch paths that invoke reflectively therefore broke 
reference identity (===) of primitive returns: classic-mode reflective call 
sites (e.g. varargs methods), and — in both compilation modes — anything routed 
through MetaMethod#doMethodInvoke, notably dynamic-name calls such as 
obj."$name"(), where a constant-name call to the same method returns the cached 
box.
   
   Reflective results are now re-normalized through the valueOf caches at the 
two chokepoints: CachedMethod#invoke (all doMethodInvoke routes) and 
PlainObjectMetaMethodSite#doInvoke (classic call sites holding a raw Method). 
The shared helper lives in MetaClassHelper#normalizeBoxedReturn. float/double 
are left as-is since valueOf does not cache them on any path. Also reproducible 
on GROOVY_5_0_X, so a candidate for backport.




> box-identity divergence for primitive varargs with classic bytecode
> -------------------------------------------------------------------
>
>                 Key: GROOVY-12140
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12140
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to