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

Eric Milles updated GROOVY-9843:
--------------------------------
    Affects Version/s: 3.x
                       4.x
                       5.x
                           (was: 4.0.0-alpha-1)
                           (was: 2.5.13)
                           (was: 3.0.6)

> 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: 3.x, 4.x, 5.x
>            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)

Reply via email to