jonenst commented on PR #1767: URL: https://github.com/apache/groovy/pull/1767#issuecomment-6682646613
In my understanding, it's just that getProperty/setProperty used to do ``` InvokerHelper.setProperty(receiver, messageName, messageArgument); ``` where invokerHelper.setProperty does a null check and replace with NullObject here: https://github.com/apache/groovy/blob/d1710f88eb6ac98a941626db47963a063f1c50e0/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java#L184 NullObject then throws the nice message here: https://github.com/apache/groovy/blob/d1710f88eb6ac98a941626db47963a063f1c50e0/src/main/java/org/codehaus/groovy/runtime/NullObject.java#L109 but https://github.com/apache/groovy/commit/f5914b9e76a085248c0ef1ca79c8e1e79ab9df7a#diff-3d4ec8c308fcf2a37f1387656356af5b02ae271cce33d01671fe461fc920cc4fL471 changed it to ```groovy if (receiver instanceof GroovyObject) { var groovyObject = (GroovyObject) receiver; groovyObject.setProperty(messageName, messageArgument); } else { MetaClass metaClass = InvokerHelper.getMetaClass(receiver); metaClass.setProperty(senderClass, receiver, messageName, messageArgument, false, false); } ``` for null the instanceof checks return false so it goes ot InvokerHelper.getMetaClass(receiver), there it falls through some more instanceof checks https://github.com/apache/groovy/blob/d1710f88eb6ac98a941626db47963a063f1c50e0/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java#L581 and ends up doing the NPE I think here, there is never a null check to replace with nullobject in this sequence : https://github.com/apache/groovy/blob/d1710f88eb6ac98a941626db47963a063f1c50e0/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java#L377 -- 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]
