[ https://issues.apache.org/jira/browse/GROOVY-11060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17724547#comment-17724547 ]
Eric Milles commented on GROOVY-11060: -------------------------------------- The root issue is missing support for spread in arrays. `['x' + *Y] as String[]` is transformed to `new String[]\{'x' + *Y}` in {{{}CastExpressionOptimizer{}}}. If you break it up as `List<String> list = ['x' + *Y]; antMatchers(list as String[])` it works. > SC internal error when spreading inside list literal > ---------------------------------------------------- > > Key: GROOVY-11060 > URL: https://issues.apache.org/jira/browse/GROOVY-11060 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 4.0.12 > Reporter: Christopher Smith > Assignee: Eric Milles > Priority: Major > > Spreading a list inside brackets causes a {{SpreadExpression should not be > visited here}} during class generation. (The business instance of this is > trying to use a list of URL patterns for Spring {{antMatchers}}.) > {code} > @CompileStatic > class Bug { > public static final List<String> A = ['a1', 'a2'] > static void varargs(String... strings) { > println Arrays.toString(strings) > } > public static void main(String... args) { > varargs([ > *A > ] as String[]) > } > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)