You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2017/01/19 12:09:27 UTC

[jira] [Commented] (GROOVY-819) Less than ideal error message when incorrectly trying to use optional parenthesis

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

Daniel Sun commented on GROOVY-819:
-----------------------------------

When using Parrot, we got the following error messages:

{{groovy.lang.MissingPropertyException: Exception evaluating property 'get' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: get for class: java.lang.String}}

> Less than ideal error message when incorrectly trying to use optional parenthesis
> ---------------------------------------------------------------------------------
>
>                 Key: GROOVY-819
>                 URL: https://issues.apache.org/jira/browse/GROOVY-819
>             Project: Groovy
>          Issue Type: Sub-task
>          Components: parser-antlr
>    Affects Versions: 1.0-JSR-1
>         Environment: GNU/Linux 2.6.8, JDK 1.5.0-b64, Groovy CVS at 2005.04.15
>            Reporter: Russel Winder
>             Fix For: 4.0
>
>
> 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)



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