groovy

Code: def Target = "releases$" returns error on line 0 / column 0

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.4
  • Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
  • Component/s: None
  • Labels:
    None
  • Environment:
    rkleeb@sifsstud4:/tmp$ groovy -v
    Groovy Version: 1.5.4 JVM: 1.6.0-b105
  • Number of attachments :
    1

Description

rkleeb@sifsstud4:/tmp$ cat bla.groovy
def Target = "releases$"

rkleeb@sifsstud4:/tmp$ groovy bla.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, /tmp/bla.groovy: 0: illegal string body character after dollar sign;
solution: either escape a literal dollar sign "\$5" or bracket the value expression "${5}" @ line 0, column 0.
1 error

the error msg that tells you to escape the $ sign makes perfect sense, but the line / col info is always 0 / 0

Activity

Hide
Roshan Dawrani added a comment -

Hi,
Found this issue to be there on all 1.5.8, 1.6RC1, and 1.7beta1 branches.

I am attaching a zip with fix patches for all these 3 affected versions.

The change has been made to file org\codehaus\groovy\antlr\groovy.g, which in the reported case was not retrieving the line/column number from the ANTLR exception.

After the fix, compiling

def target="Roshan$"

correctly shows the line/column information in the exception as
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, C:\Try.groovy: 1: illegal string body character after dollar sign;
solution: either escape a literal dollar sign "\$5" or bracket the value expression "${5}" @ line 1, column 20.

rgds,
Roshan

Show
Roshan Dawrani added a comment - Hi, Found this issue to be there on all 1.5.8, 1.6RC1, and 1.7beta1 branches. I am attaching a zip with fix patches for all these 3 affected versions. The change has been made to file org\codehaus\groovy\antlr\groovy.g, which in the reported case was not retrieving the line/column number from the ANTLR exception. After the fix, compiling
def target="Roshan$"
correctly shows the line/column information in the exception as org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, C:\Try.groovy: 1: illegal string body character after dollar sign; solution: either escape a literal dollar sign "\$5" or bracket the value expression "${5}" @ line 1, column 20. rgds, Roshan
Hide
blackdrag blackdrag added a comment -

patch plus test case applied

Show
blackdrag blackdrag added a comment - patch plus test case applied

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: