[ 
https://issues.apache.org/jira/browse/GROOVY-8036?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15803676#comment-15803676
 ] 

John Wagenleitner commented on GROOVY-8036:
-------------------------------------------

I can't replicate that error (NPE):

{code}
$ cat groovy8036.groovy 
int a = 5
[1..a].each
{ -> println "qwerty" }
{code}

{code}
$ ./groovy-2.4.7/bin/groovy groovy8036.groovy
Caught: groovy.lang.MissingMethodException: No signature of method: 
groovy8036$_run_closure1.doCall() is applicable for argument types: 
(groovy.lang.IntRange) values: [1..5]
Possible solutions: doCall(), findAll(), findAll(), isCase(java.lang.Object), 
isCase(java.lang.Object)
groovy.lang.MissingMethodException: No signature of method: 
groovy8036$_run_closure1.doCall() is applicable for argument types: 
(groovy.lang.IntRange) values: [1..5]
Possible solutions: doCall(), findAll(), findAll(), isCase(java.lang.Object), 
isCase(java.lang.Object)
        at groovy8036.run(groovy8036.groovy:2)
{code}

> Compiler throws NPE
> -------------------
>
>                 Key: GROOVY-8036
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8036
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.7
>            Reporter: Tommy Svensson
>
> With code like this:
> int a = 5
> [1..a].each { ->
>    println "qwerty"
> }
> the compiler throws an NPE. OK, this is incorrect code since it is missing a 
> value before '->', but this should preferably produce an error message and 
> not an NPE :-)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to