[
https://issues.apache.org/jira/browse/GROOVY-11858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-11858:
---------------------------------
Description:
This code throws an exception:
{code:groovy}
'a b c'.tap { println(split()) }
{code}
The exception message:
{code}
NullPointerException: Cannot invoke
"groovy.lang.Closure.getMaximumNumberOfParameters()" because "wrapped" is null
{code}
If I pass an argument to split, it works as expected:
{code:groovy}
'a b c'.tap { println(split(' ')) }
{code}
was:
This code throws an exception:
{code:groovy}
'a b c'.tap { println(split()) }
{code}
The exception message:
{code}
NullPointerException: Cannot invoke
"groovy.lang.Closure.getMaximumNumberOfParameters()" because "wrapped" is null
{code}
If I pass an argument to split, it works as expected:
{code:groovy}
'a b c'.tap\{println(split(' '))}
{code}
> Splitting string inside tap closure throws NullPointerException
> ---------------------------------------------------------------
>
> Key: GROOVY-11858
> URL: https://issues.apache.org/jira/browse/GROOVY-11858
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 5.0.4
> Reporter: Evan Shaw
> Priority: Major
>
> This code throws an exception:
> {code:groovy}
> 'a b c'.tap { println(split()) }
> {code}
> The exception message:
> {code}
> NullPointerException: Cannot invoke
> "groovy.lang.Closure.getMaximumNumberOfParameters()" because "wrapped" is null
> {code}
> If I pass an argument to split, it works as expected:
> {code:groovy}
> 'a b c'.tap { println(split(' ')) }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)