[
https://issues.apache.org/jira/browse/GROOVY-8015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15716251#comment-15716251
]
Paul King commented on GROOVY-8015:
-----------------------------------
This is a known issue with the current grammar misinterpreting the two trailing
greater than signs as the '>>' operator.
The other workaround is just to place a space between those two chars. It's a
bit of a weird error from memory. The '>>' is triggered during a rule guard but
then disambiguated properly in the actual grammar rules. There are a few
different places where it crops up to bite us. I think there is an existing
issue somewhere too.
> Strange groovy behavior
> -----------------------
>
> Key: GROOVY-8015
> URL: https://issues.apache.org/jira/browse/GROOVY-8015
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.4.5
> Environment: groovy -v
> Groovy Version: 2.4.5 JVM: 1.8.0_112 Vendor: Oracle Corporation OS: Linux
> java -version
> java version "1.8.0_112"
> Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
> Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)
> Reporter: AndreyT
> Priority: Trivial
>
> {code}
> String s = 'anyString'
> Long l = 1
> def m = [(s): [l]] as Map<String,List<Long>>
> def g = 1
> {code}
> Code above cause exception:
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> /tmp/t.groovy: 5: expecting EOF, found 'def' @ line 5, column 1.
> {code}
> If add `;` at the end of `def m = [(s): [l]] as Map<String,List<Long>>`, then
> all works fine.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)