[ https://issues.apache.org/jira/browse/GROOVY-7157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14602316#comment-14602316 ]
Paul King edited comment on GROOVY-7157 at 6/26/15 11:52 AM: ------------------------------------------------------------- The grammar also passes these: {code} def list = [[1]] as List<List<Integer> > // note space def list2 = [[1]] as List<List<Integer>/* */> // note comment def list3 = [[1]] as List<List<Integer>>; def list4 = (List<List<Integer>>)[[1]] {code} The same behaviour is noted for binary assignments or declarations, e.g. this is also an error: {code} def list list = [[1]] as List<List<Integer>> 42 {code} but if the closing brackets are the list thing in the file, then it works, e.g.: {code} def list = [[1]] as List<List<Integer>> // passes {code} was (Author: paulk): The grammar also passes these: {code} def list = [[1]] as List<List<Integer> > // note space def list2 = [[1]] as List<List<Integer>/* */> // note comment def list3 = [[1]] as List<List<Integer>>; def list4 = (List<List<Integer>>)[[1]] {code} The same behaviour is noted for binary assignments or declarations, e.g. this is also an error: {code} def list list = [[1]] as List<List<Integer>> {code} > CompilationError for [[1]] as List<List<Integer>> > ------------------------------------------------- > > Key: GROOVY-7157 > URL: https://issues.apache.org/jira/browse/GROOVY-7157 > Project: Groovy > Issue Type: Bug > Components: Compiler > Affects Versions: 2.3.7, 2.4.0-beta-3 > Reporter: Yu Kobayashi > > I can run this code, > {code} > def list = ([[1]] as List<List<Integer>>) > println list > {code} > but cannot run this code. > {code} > def list = [[1]] as List<List<Integer>> > println list > {code} > Error message: > {code} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > C:\Users\Yu\Desktop\test.groovy: 2: expecting EOF, found 'println' @ line 2, > column 1. > println list > ^ > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)