[ 
https://issues.apache.org/jira/browse/GROOVY-11874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-11874.
------------------------------

> SC: map getAt null safety
> -------------------------
>
>                 Key: GROOVY-11874
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11874
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 5.0.4
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.5
>
>
> Consider the following:
> {code:groovy}
> @groovy.transform.CompileStatic
> def test(String prop) {
>   def map = [:]
>   map[prop]
> }
> test()
> {code}
> Prior to Groovy 5, this returns null.  Now it throws:
> {code}
> java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because 
> "name" is null
>       at Script1.test(Script1.groovy:4)
>       at Script1.run(Script1.groovy:6)
> {code}



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

Reply via email to