[
https://issues.apache.org/jira/browse/GROOVY-6154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-6154.
-----------------------------
> Property added as getName() extension method for every Object isn't
> accessible for null
> ---------------------------------------------------------------------------------------
>
> Key: GROOVY-6154
> URL: https://issues.apache.org/jira/browse/GROOVY-6154
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Reporter: Mykola Golubyev
> Priority: Major
>
> When you add an extension method using
> org.codehaus.groovy.runtime.ExtensionModule
> static int getAge(Object o) { return 15; }
> you can call the method using Groovy property shortcut like
> def value = 1
> assert value.age == 15
> assert value.getAge() == 15
> however when value is null Groovy property shortcut doesn't work
> but getAge() method still works as expected
> def value = null
> assert value.age == 15 // Cannot get property 'age' on null object
> assert value.getAge() == 15
--
This message was sent by Atlassian Jira
(v8.20.1#820001)