[
https://issues.apache.org/jira/browse/GROOVY-9843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-9843:
--------------------------------
Component/s: parser-antlr4
> Line-wrapped assignment, typecast, method call parsed as class literal
> assignment
> ---------------------------------------------------------------------------------
>
> Key: GROOVY-9843
> URL: https://issues.apache.org/jira/browse/GROOVY-9843
> Project: Groovy
> Issue Type: Bug
> Components: parser, parser-antlr4
> Affects Versions: 4.0.0-alpha-1, 2.5.13, 3.0.6
> Reporter: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:groovy}
> def foo() {
> }
> @groovy.transform.TypeChecked
> def bar() {
> Number n = (java.lang.Number)
> foo()
> }
> {code}
> In our case "java.lang.Number" is quite a long type name and "foo" is quite a
> long method name, so we tried adding a newline between the typecast and the
> method call. This change causes Groovy to parse the sequence as two
> statements: "Number n = Number.class" and "foo()".
> I'm guessing that "(TypeName)" is very rarely a class literal, except for
> maybe in a map literal. Preference for a typecast seems needed.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)