Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7670

CLONE - dash in script filename

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.4.5
    • Fix Version/s: None
    • Component/s: class generator
    • Labels:
      None
    • Environment:
      Oracle Java 8, Windows (although OS is not relevant IMHO)

      Description

      Cannot create script with dash ("-") in filename.

      Please try to run the two attached groovy scripts. The one with an underscore in the filename runs happily (don't wonder, it gives no output). The one with a dash in the filename gives this error:

      $ groovy fibonacci-numbers.groovy
      Caught: java.lang.ClassFormatError: Illegal class name "fibonacci-numbers$fib" in class file fibonacci-numbers$fib
      java.lang.ClassFormatError: Illegal class name "fibonacci-numbers$fib" in class file fibonacci-numbers$fib
              at fibonacci-numbers.run(fibonacci-numbers.groovy:5)

      It really took me some time to figure out that the dash was causing this. I would like to see Groovy allowing dashes in script filenames. If that should be impossible, at least the error message should cleary indicate that I have used an illegal character in the script filename.

        Attachments

        1. fibonacci_numbers.groovy
          0.2 kB
          Christoph Grothaus
        2. fibonacci-numbers.groovy
          0.2 kB
          Christoph Grothaus

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                cgrothaus Christoph Grothaus
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: