You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/02/05 17:46:00 UTC

[jira] [Resolved] (GROOVY-8810) Groovy doesn't support concatenation symbol at line start

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

Eric Milles resolved GROOVY-8810.
---------------------------------
    Resolution: Information Provided

> Groovy doesn't support concatenation symbol at line start
> ---------------------------------------------------------
>
>                 Key: GROOVY-8810
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8810
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>            Reporter: ori marko
>            Priority: Major
>
> Groovy doesn't support concatenation using + or << *at line start*,
> Use case: Need to concatenate a many variables and want to make it readable, but failed to separate lines similar to  java
> 1. Java supported code:
> String text= "0"+"1" +
> "2" 
> +"3";
>  
> Error:
> javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: java.lang.String.positive() is applicable for argument types: () values: []
> Possible solutions: notify(), tokenize(), size(), size()
>  
> 2. groovy concatenation split in new line(s):
> {{String text ="<id>" <<vars["id1"] << "<id><id2>" }}
> {{<< vars["id2"] << "<id2>";}}
> {{Error:}}
> Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Script1.groovy: 2: unexpected token: << @ line 2, column 1.
>    << vars["id2"] << "<id2>"



--
This message was sent by Atlassian Jira
(v8.20.1#820001)