You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2017/01/20 01:35:26 UTC

[jira] [Assigned] (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 ">>"

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

Daniel Sun reassigned GROOVY-5652:
----------------------------------

    Assignee: Daniel Sun

> 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
>             Fix For: 4.0
>
>
> 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
(v6.3.4#6332)