You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jochen Theodorou (JIRA)" <ji...@apache.org> on 2017/05/12 09:07:07 UTC

[jira] [Commented] (GROOVY-8187) Closure MissingPropertyException

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

Jochen Theodorou commented on GROOVY-8187:
------------------------------------------

I would have expected case 2 to fail as well, because I would have expected, that Groovy does not see this as an attached block

> Closure MissingPropertyException
> --------------------------------
>
>                 Key: GROOVY-8187
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8187
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.11
>         Environment: Distributor ID:	Ubuntu
> Description:	Ubuntu 16.04.2 LTS
> Release:	16.04
> Codename:	xenial
> Groovy Version: 2.4.11 JVM: 1.8.0_121 Vendor: Oracle Corporation OS: Linux
>            Reporter: Jasmin Patel
>            Priority: Minor
>         Attachments: Test.groovy
>
>
> {code:none}
> 		return (1..1000)
> 				.any(
> 				{
> 					final it ->
> 						it % 2000 == 2000
> 				})
> {code}
> {code:none}
> 		println(
> 				(1..1000)
> 						.any
> 						{
> 							final it ->
> 								it % 2000 == 2000
> 						}
> 		)
> {code}
> {code:none}
> 		return (1..1000)
> 				.any
> 				{
> 					final it ->
> 						it % 2000 == 2000
> 				}
> {code}
> First snippet works, so does second. Third one causes the following exception:
> groovy.lang.MissingPropertyException: Exception evaluating property 'any' for groovy.lang.IntRange, Reason: groovy.lang.MissingPropertyException: No such property: any for class: java.lang.Integer



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)