Eric Milles created GROOVY-11874:
------------------------------------

             Summary: 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


Consider the following:
{code:groovy}
@groovy.transform.CompileStatic
def test(String name) {
  def map = [:]
  map[name]
}
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