groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (GROOVY-7218) && operator is not handled correctly in some cases when it starts a new line
Date Tue, 06 Mar 2018 23:26:10 GMT

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

Paul King closed GROOVY-7218.
-----------------------------

> && operator is not handled correctly in some cases when it starts a new line
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-7218
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7218
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.3.8
>         Environment: CentOS 7
>            Reporter: Maxim Novikov
>            Assignee: John Wagenleitner
>            Priority: Minor
>             Fix For: 2.6.0-alpha-1
>
>
> h3. Repro
> {code:title=A.groovy|borderStyle=solid}
> def files = new File(".").list(
>     [ accept: { d, f ->
>         (f ==~ ".*") && !f.endsWith(".tmp")
>     }] as FilenameFilter
> ).toList()
> {code}
> *Result:* works fine
> {code:title=B.groovy|borderStyle=solid}
> def files = new File(".").list(
>     [ accept: { d, f ->
>         (f ==~ ".*")
>             && !f.endsWith(".tmp")
>     }] as FilenameFilter
> ).toList()
> {code}
> *Result:*
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> /home/csbubbles/B.groovy: 5: unexpected token: && @ line 5, column 3.
>    		&& !f.endsWith(".tmp")
>      ^
> 1 error
> {code}
> h3. Expected results
> B.groovy should get executed successfully the same way as A.groovy, as its two lines
in a closure is the only expression.
> PS "return" statement doesn't help if you put it before "(f ==~ ".*")" either.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message