You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Magnus Reftel (JIRA)" <ji...@apache.org> on 2017/01/17 08:21:26 UTC

[jira] [Commented] (GROOVY-6220) Compiler gives very cryptic error messages for unterminated regexes

    [ https://issues.apache.org/jira/browse/GROOVY-6220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15825627#comment-15825627 ] 

Magnus Reftel commented on GROOVY-6220:
---------------------------------------

Slightly smaller testcase: 

$ ~/opt/groovy-2.4.8/bin/groovy -e '/a'
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script_from_command_line: 1: unexpected char: 0xFFFF @ line 1, column 3.
   /a
     ^

1 error


> Compiler gives very cryptic error messages for unterminated regexes
> -------------------------------------------------------------------
>
>                 Key: GROOVY-6220
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6220
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 1.8.6, 2.4.5
>         Environment: Used with Gradle 1.6 on Windows XP.
>            Reporter: Tomas Lycken
>            Priority: Minor
>         Attachments: build.gradle, SillyClass.groovy
>
>
> When a Groovy class file has an unterminated regex somewhere, the compiler states that there is an invalid character 0xFFFF at the end of the file, rather than pointing at the unterminated regex.
> MWE (also attached)
>     package silly
>     public class SillyClass {
>         public SillyClass() {
>             println "testString".replaceAll(/\B[A-Z]) { it.toLowerCase() }
>         }
>     }
> Compiler error:
> <project path...>\src\main\groovy\silly\SillyClass.groovy: 9: unexpected char: 0xFFFF @ line 9, column 1.
> 1 error
> If this error is fixed in a later Groovy release, please let me know so I can file an issue with Gradle to update =)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)