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

Paul King closed GROOVY-5652.
-----------------------------

> Semicolon required after coercing to a parameterized (generic) type 
> containing a parameterized (generic) type as its only or last type argument 
> when there is no space between the ending ">>"
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-5652
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5652
>             Project: Groovy
>          Issue Type: Bug
>          Components: parser-antlr
>    Affects Versions: 1.8.6
>            Reporter: Amy Chuo
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 2.6.0-alpha-1
>
>
> It seems that after coercing an object to a parameterized (generic) type 
> containing a parameterized (generic) type as its only or last type argument 
> without putting any space between the ending ">>", a semicolon is needed.
> Example:
> $ groovy -v
> Groovy Version: 1.8.6 JVM: 1.6.0_30 Vendor: Sun Microsystems Inc. OS: Linux
> $ groovy -e "def list = [1,2,3,4] as List<Integer>
> println list
> println 'bye'" # This works fine.
> [1, 2, 3, 4]
> bye
> $ groovy -e "def list = [[1,2],[3,4]] as List<List<Integer>>
> println list
> println 'bye'" # This should work fine, but does not.
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> script_from_command_line: 2: expecting EOF, found 'println' @ line 2, column 
> 1.
>    println list
>    ^
> 1 error
> $ groovy -e "def list = [[1,2],[3,4]] as List<List<Integer> >
> println list
> println 'bye'" # After adding a space between ">>", this works fine.
> [[1, 2], [3, 4]]
> bye
> $ groovy -e "def list = [[1,2],[3,4]] as List<List<Integer>>;
> println list
> println 'bye'" # Or, after adding a semicolon, this works fine.
> [[1, 2], [3, 4]]
> bye
> $



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

Reply via email to