Groovy
  1. Groovy
  2. GROOVY-3524

MultipleCompilationErrorsException "unexpected char"

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.6.1, 1.6.2, 1.6.3
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Linux (RHEL 5, Fedora Core 5)

      Description

      Getting an error in groovy one-liners:

      $ groovy -e 'println "Hello, World!"'
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, script_from_command_line: 1: unexpected char: 0xFFFF @ line 1, column 23.
      1 error
      

      Putting the same thing in a file works fine. It doesn't happen for the following:

      $ groovy -e 'println '\''Hello, World!'\'
      $ groovy -e 'println "Hello, World!";'
      $ groovy -e 'println "";'
      $ groovy -e ''
      $ groovy -e 'println 1'
      $ groovy -e 'println System.properties'
      

      When you use a zero-length string literal, you get a slightly different error:

      $ groovy -e 'println ""'
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, script_from_command_line: 1: unexpected char: '"' @ line 1, column 9.
      1 error
      

        Activity

        Mike Dillon created issue -
        Hide
        Mike Dillon added a comment -

        To be clear, this seems to be related to double-quoted string literals with no trailing semicolon in command-line eval mode in Groovy 1.6.1-1.6.3.

        Show
        Mike Dillon added a comment - To be clear, this seems to be related to double-quoted string literals with no trailing semicolon in command-line eval mode in Groovy 1.6.1-1.6.3.
        Guillaume Delcroix made changes -
        Field Original Value New Value
        Fix Version/s 1.6.4 [ 15291 ]
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.6.4 [ 15291 ]
        Fix Version/s 1.6.x [ 15537 ]
        Jochen Theodorou made changes -
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Fix Version/s 1.7-beta-x [ 15538 ]
        Hide
        Ismael Fal added a comment -

        I have this issue, Windows 2003, groovy 1.6.4 JVM 1.5.0_06.

        I compile use.groovy : println 'Allah is great';

        I run groovy use.class and I get:

        org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed,
        C:\groovy\bin\use.class: 1: unexpected char: 0xBA @ line 1, column 3.
        ╩■║╛ /☺◄☺ ♥use ☺☺ ↕groovy/lang/Script ♥☺
        ^

        1 error

        Show
        Ismael Fal added a comment - I have this issue, Windows 2003, groovy 1.6.4 JVM 1.5.0_06. I compile use.groovy : println 'Allah is great'; I run groovy use.class and I get: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, C:\groovy\bin\use.class: 1: unexpected char: 0xBA @ line 1, column 3. ╩■║╛ /☺◄☺ ♥use ☺☺ ↕groovy/lang/Script ♥☺ ^ 1 error
        Hide
        Jochen Theodorou added a comment -

        you are not supposed to run a .class file this way. The .class file is supposed to be run using the java command.

        Show
        Jochen Theodorou added a comment - you are not supposed to run a .class file this way. The .class file is supposed to be run using the java command.
        Hide
        Paul King added a comment -

        The following works fine on both windows and Linux:

        groovy -e "println 'hello'"
        
        Show
        Paul King added a comment - The following works fine on both windows and Linux: groovy -e "println 'hello'"
        Jochen Theodorou made changes -
        Fix Version/s 1.6.x [ 15537 ]
        Jochen Theodorou made changes -
        Fix Version/s 1.8.x [ 15750 ]
        Fix Version/s 2.x [ 17013 ]
        Fix Version/s 1.7.x [ 15538 ]
        Pascal Schumacher made changes -
        Fix Version/s 2.x [ 17013 ]
        Fix Version/s 1.8.x [ 15750 ]
        Component/s command line processing [ 10445 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12732515 ] Default workflow, editable Closed status [ 12744364 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12967417 ] Default workflow, editable Closed status [ 12975144 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Mike Dillon
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development