Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4705 Compiler internals improvements collection task for Groovy 4
  3. GROOVY-819

Less than ideal error message when incorrectly trying to use optional parenthesis

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 1.0-JSR-1
    • None
    • parser-antlr2
    • None
    • GNU/Linux 2.6.8, JDK 1.5.0-b64, Groovy CVS at 2005.04.15

    Description

      The script:

      adob = new ArrayList ( )
      adob.add "hello"
      println adob.get 0

      generates the following error report. The report is seemingly incorrect (why should it be expecting EOF) and say nothing about the real problem which is that the ( was not found. The problem is in the error reporting not in the grammar.

      Caught: General error during parsing: expecting EOF, found '0'

      /home/users/russel/Progs/Groovy/./topLevel.groovy:5:18: expecting EOF, found '0'
      at antlr.Parser.match(Parser.java:211)
      at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:675)
      at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:79)
      at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:297)
      at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:352)
      at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:594)
      at org.codehaus.groovy.control.CompilationUnit.parse(CompilationUnit.java:343)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:313)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:235)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:204)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:154)
      at groovy.lang.GroovyShell$1.run(GroovyShell.java:261)
      at java.security.AccessController.doPrivileged(Native Method)
      at groovy.lang.GroovyShell.run(GroovyShell.java:259)
      at groovy.lang.GroovyShell.run(GroovyShell.java:202)
      at groovy.ui.GroovyMain.processOnce(GroovyMain.java:397)
      at groovy.ui.GroovyMain.run(GroovyMain.java:233)
      at groovy.ui.GroovyMain.process(GroovyMain.java:219)
      at groovy.ui.GroovyMain.main(GroovyMain.java:123)
      at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:92)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:429)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

      Attachments

        Activity

          People

            Unassigned Unassigned
            russel Dr. Russel Winder
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: