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

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

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

   …zed metaclass
   
   addMetaBeanProperty, addNewInstanceMethod and addNewStaticMethod mutated an 
initialized MetaClassImpl in place with no version bump and no invalidation, so 
call-site caches kept serving the pre-change state while fresh lookups saw it — 
silently undefined behavior. Guard all three like addMetaMethod always was, 
enforcing the contract MutableMetaClass already documents: additions belong 
before initialize(); runtime changes belong on ExpandoMetaClass, whose mutation 
window lifts the guard. EMC's lazy memoization of an inherited expando property 
now runs inside that window (onSuperPropertyFoundInHierarchy mirrors 
addSuperMethodIfNotOverridden, whose addMetaMethod call was always guarded), 
keeping the two hierarchy-found hooks symmetric.




> MetaClassImpl.addMetaBeanProperty (and addNewInstance/StaticMethod) should 
> reject an initialized metaclass like addMetaMethod does
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12308
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12308
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Priority: Major
>




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

Reply via email to