[jira] [Commented] (GROOVY-8678) Groovy Script execution fails when comparing decimal values against decimal constant without leading 0
[ https://issues.apache.org/jira/browse/GROOVY-8678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17561967#comment-17561967 ] Paul King commented on GROOVY-8678: --- This was also merged into 3.0.9: https://github.com/apache/groovy/commit/9ce8e3936 > Groovy Script execution fails when comparing decimal values against decimal > constant without leading 0 > -- > > Key: GROOVY-8678 > URL: https://issues.apache.org/jira/browse/GROOVY-8678 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime, Groovysh >Affects Versions: 2.4.x, 2.5.0, 3.0.0-rc-3 >Reporter: Dyutimoy Sarkar >Assignee: Paul King >Priority: Major > Fix For: 4.0.0-beta-1 > > Time Spent: 2h > Remaining Estimate: 0h > > Hi, > I am reporting the following bug as I am not able to ascertain from the web > if what I am facing is a consequence of desired intent. > Using groovy shell to execute the following groovy script snippet fails at > compilation phase when executing the script through java. I am using Jre1.7 > {code:java} > public static void main(String[] args) throws Exception, > IllegalAccessException { > Object evaluate = new GroovyShell().evaluate("\"abcd\".length() == .34"); > System.out.println("result: " + evaluate); > }{code} > In the above snippet, If I replace *.34* with *0.34* then the script > execution works as expected. > Exception reported is as follows > {code:java} > Exception in thread "main" > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > Script1.groovy: 1: unexpected token: . @ line 1, column 20. > "abcd".length() == .34 > ^ > 1 error > at > org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311) > at > org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:151) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:121) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:133) > at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:332) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:226) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:192) > at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:230) > at > org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:186) > at > org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:968) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:633) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586) > at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:352) > at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:85) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:321) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:318) > at > org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:316) > at groovy.lang.GroovyShell.parseClass(GroovyShell.java:548) > at groovy.lang.GroovyShell.parse(GroovyShell.java:560) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:444) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:483) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:454) > at groovytest.Testtest.main(Testtest.java:19) > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (GROOVY-8678) Groovy Script execution fails when comparing decimal values against decimal constant without leading 0
[ https://issues.apache.org/jira/browse/GROOVY-8678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17361758#comment-17361758 ] Paul King commented on GROOVY-8678: --- I updated the Groovy 4 release notes: https://github.com/apache/groovy-website/blob/asf-site/site/src/site/releasenotes/groovy-4.0.adoc#support-for-decimal-fraction-literals-without-a-leading-zero > Groovy Script execution fails when comparing decimal values against decimal > constant without leading 0 > -- > > Key: GROOVY-8678 > URL: https://issues.apache.org/jira/browse/GROOVY-8678 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime, Groovysh >Affects Versions: 2.4.x, 2.5.0, 3.0.0-rc-3 >Reporter: Dyutimoy Sarkar >Assignee: Paul King >Priority: Major > Fix For: 4.0.0-beta-1 > > Time Spent: 20m > Remaining Estimate: 0h > > Hi, > I am reporting the following bug as I am not able to ascertain from the web > if what I am facing is a consequence of desired intent. > Using groovy shell to execute the following groovy script snippet fails at > compilation phase when executing the script through java. I am using Jre1.7 > {code:java} > public static void main(String[] args) throws Exception, > IllegalAccessException { > Object evaluate = new GroovyShell().evaluate("\"abcd\".length() == .34"); > System.out.println("result: " + evaluate); > }{code} > In the above snippet, If I replace *.34* with *0.34* then the script > execution works as expected. > Exception reported is as follows > {code:java} > Exception in thread "main" > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > Script1.groovy: 1: unexpected token: . @ line 1, column 20. > "abcd".length() == .34 > ^ > 1 error > at > org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311) > at > org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:151) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:121) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:133) > at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:332) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:226) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:192) > at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:230) > at > org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:186) > at > org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:968) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:633) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586) > at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:352) > at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:85) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:321) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:318) > at > org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:316) > at groovy.lang.GroovyShell.parseClass(GroovyShell.java:548) > at groovy.lang.GroovyShell.parse(GroovyShell.java:560) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:444) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:483) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:454) > at groovytest.Testtest.main(Testtest.java:19) > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (GROOVY-8678) Groovy Script execution fails when comparing decimal values against decimal constant without leading 0
[ https://issues.apache.org/jira/browse/GROOVY-8678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17024207#comment-17024207 ] Paul King commented on GROOVY-8678: --- For the Parrot parser, the error message is: {{Unexpected input: '.' at line: 1, column: 20}} > Groovy Script execution fails when comparing decimal values against decimal > constant without leading 0 > -- > > Key: GROOVY-8678 > URL: https://issues.apache.org/jira/browse/GROOVY-8678 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime, Groovysh >Affects Versions: 2.4.x, 2.5.0 >Reporter: Dyutimoy Sarkar >Priority: Major > Fix For: 4.x > > > Hi, > I am reporting the following bug as I am not able to ascertain from the web > if what I am facing is a consequence of desired intent. > Using groovy shell to execute the following groovy script snippet fails at > compilation phase when executing the script through java. I am using Jre1.7 > {code:java} > public static void main(String[] args) throws Exception, > IllegalAccessException { > Object evaluate = new GroovyShell().evaluate("\"abcd\".length() == .34"); > System.out.println("result: " + evaluate); > }{code} > In the above snippet, If I replace *.34* with *0.34* then the script > execution works as expected. > Exception reported is as follows > {code:java} > Exception in thread "main" > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > Script1.groovy: 1: unexpected token: . @ line 1, column 20. > "abcd".length() == .34 > ^ > 1 error > at > org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311) > at > org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:151) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:121) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:133) > at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:332) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:226) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:192) > at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:230) > at > org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:186) > at > org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:968) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:633) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586) > at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:352) > at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:85) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:321) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:318) > at > org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:316) > at groovy.lang.GroovyShell.parseClass(GroovyShell.java:548) > at groovy.lang.GroovyShell.parse(GroovyShell.java:560) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:444) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:483) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:454) > at groovytest.Testtest.main(Testtest.java:19) > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (GROOVY-8678) Groovy Script execution fails when comparing decimal values against decimal constant without leading 0
[ https://issues.apache.org/jira/browse/GROOVY-8678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16805697#comment-16805697 ] Paul King commented on GROOVY-8678: --- We are unlikely to have a 2.5.x fix since as well as readability, I think it was hard to do for the old parser. I would leave it open for 3.x but we need to dive a bit deeper before we can say for sure whether it is even possible given Groovy's other grammar rules etc. > Groovy Script execution fails when comparing decimal values against decimal > constant without leading 0 > -- > > Key: GROOVY-8678 > URL: https://issues.apache.org/jira/browse/GROOVY-8678 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime, Groovysh >Affects Versions: 2.4.x, 2.5.0 >Reporter: Dyutimoy Sarkar >Priority: Major > Fix For: 3.x > > > Hi, > I am reporting the following bug as I am not able to ascertain from the web > if what I am facing is a consequence of desired intent. > Using groovy shell to execute the following groovy script snippet fails at > compilation phase when executing the script through java. I am using Jre1.7 > {code:java} > public static void main(String[] args) throws Exception, > IllegalAccessException { Object evaluate = new > GroovyShell().evaluate("\"abcd\".length() == .34"); > System.out.println("result: " + evaluate); > }{code} > In the above snippet, If I replace *.34* with *0.34* then the script > execution works as expected. > Exception reported is as follows > {code:java} > Exception in thread "main" > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > Script1.groovy: 1: unexpected token: . @ line 1, column 20. > "abcd".length() == .34 > ^ > 1 error > at > org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311) > at > org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:151) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:121) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:133) > at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:332) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:226) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:192) > at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:230) > at > org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:186) > at > org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:968) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:633) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586) > at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:352) > at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:85) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:321) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:318) > at > org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:316) > at groovy.lang.GroovyShell.parseClass(GroovyShell.java:548) > at groovy.lang.GroovyShell.parse(GroovyShell.java:560) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:444) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:483) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:454) > at groovytest.Testtest.main(Testtest.java:19) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8678) Groovy Script execution fails when comparing decimal values against decimal constant without leading 0
[ https://issues.apache.org/jira/browse/GROOVY-8678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16802184#comment-16802184 ] Jochen Theodorou commented on GROOVY-8678: -- Seeing this only now for some reason the decision was to not support decimals without leading 0 as a number because of readability. This was a decision taken back in pre Groovy JSR times.. > Groovy Script execution fails when comparing decimal values against decimal > constant without leading 0 > -- > > Key: GROOVY-8678 > URL: https://issues.apache.org/jira/browse/GROOVY-8678 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime, Groovysh >Affects Versions: 2.4.x, 2.5.0 >Reporter: Dyutimoy Sarkar >Priority: Major > Fix For: 3.x > > > Hi, > I am reporting the following bug as I am not able to ascertain from the web > if what I am facing is a consequence of desired intent. > Using groovy shell to execute the following groovy script snippet fails at > compilation phase when executing the script through java. I am using Jre1.7 > {code:java} > public static void main(String[] args) throws Exception, > IllegalAccessException { Object evaluate = new > GroovyShell().evaluate("\"abcd\".length() == .34"); > System.out.println("result: " + evaluate); > }{code} > In the above snippet, If I replace *.34* with *0.34* then the script > execution works as expected. > Exception reported is as follows > {code:java} > Exception in thread "main" > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > Script1.groovy: 1: unexpected token: . @ line 1, column 20. > "abcd".length() == .34 > ^ > 1 error > at > org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311) > at > org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:151) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:121) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:133) > at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:332) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:226) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:192) > at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:230) > at > org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:186) > at > org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:968) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:633) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586) > at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:352) > at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:85) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:321) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:318) > at > org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:316) > at groovy.lang.GroovyShell.parseClass(GroovyShell.java:548) > at groovy.lang.GroovyShell.parse(GroovyShell.java:560) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:444) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:483) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:454) > at groovytest.Testtest.main(Testtest.java:19) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8678) Groovy Script execution fails when comparing decimal values against decimal constant without leading 0
[ https://issues.apache.org/jira/browse/GROOVY-8678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16532188#comment-16532188 ] Dyutimoy Sarkar commented on GROOVY-8678: - Thank you Paul for seeing the bug. As suggested I reached out to [d...@groovy.apache.org|mailto:d...@groovy.apache.org] with the bug I have raised. > Groovy Script execution fails when comparing decimal values against decimal > constant without leading 0 > -- > > Key: GROOVY-8678 > URL: https://issues.apache.org/jira/browse/GROOVY-8678 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime, Groovysh >Affects Versions: 2.4.x, 2.5.0 >Reporter: Dyutimoy Sarkar >Priority: Major > Fix For: 2.4.x, 2.5.x > > > Hi, > I am reporting the following bug as I am not able to ascertain from the web > if what I am facing is a consequence of desired intent. > Using groovy shell to execute the following groovy script snippet fails at > compilation phase when executing the script through java. I am using Jre1.7 > {code:java} > public static void main(String[] args) throws Exception, > IllegalAccessException { Object evaluate = new > GroovyShell().evaluate("\"abcd\".length() == .34"); > System.out.println("result: " + evaluate); > }{code} > In the above snippet, If I replace *.34* with *0.34* then the script > execution works as expected. > Exception reported is as follows > {code:java} > Exception in thread "main" > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > Script1.groovy: 1: unexpected token: . @ line 1, column 20. > "abcd".length() == .34 > ^ > 1 error > at > org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311) > at > org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:151) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:121) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:133) > at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:332) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:226) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:192) > at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:230) > at > org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:186) > at > org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:968) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:633) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586) > at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:352) > at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:85) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:321) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:318) > at > org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:316) > at groovy.lang.GroovyShell.parseClass(GroovyShell.java:548) > at groovy.lang.GroovyShell.parse(GroovyShell.java:560) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:444) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:483) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:454) > at groovytest.Testtest.main(Testtest.java:19) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8678) Groovy Script execution fails when comparing decimal values against decimal constant without leading 0
[ https://issues.apache.org/jira/browse/GROOVY-8678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16531230#comment-16531230 ] Paul King commented on GROOVY-8678: --- I have a vague recollection that this has been discussed before but a quick search didn't reveal the discussion. I can't remember if it was a limitation of the parser at the time or a deliberate intent to match some numeric standard. If the former, the new grammar in Groovy 3 might be a great time to look at a change. It might pay to ask on the mailing list since not everyone reads the Jira activity. > Groovy Script execution fails when comparing decimal values against decimal > constant without leading 0 > -- > > Key: GROOVY-8678 > URL: https://issues.apache.org/jira/browse/GROOVY-8678 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime, Groovysh >Affects Versions: 2.4.x, 2.5.0 >Reporter: Dyutimoy Sarkar >Priority: Major > Fix For: 2.4.x, 2.5.x > > > Hi, > I am reporting the following bug as I am not able to ascertain from the web > if what I am facing is a consequence of desired intent. > Using groovy shell to execute the following groovy script snippet fails at > compilation phase when executing the script through java. I am using Jre1.7 > {code:java} > public static void main(String[] args) throws Exception, > IllegalAccessException { Object evaluate = new > GroovyShell().evaluate("\"abcd\".length() == .34"); > System.out.println("result: " + evaluate); > }{code} > In the above snippet, If I replace *.34* with *0.34* then the script > execution works as expected. > Exception reported is as follows > {code:java} > Exception in thread "main" > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > Script1.groovy: 1: unexpected token: . @ line 1, column 20. > "abcd".length() == .34 > ^ > 1 error > at > org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:311) > at > org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:151) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:121) > at > org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:133) > at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:332) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:226) > at > org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:192) > at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:230) > at > org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:186) > at > org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:968) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:633) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586) > at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:352) > at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:85) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:321) > at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:318) > at > org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:316) > at groovy.lang.GroovyShell.parseClass(GroovyShell.java:548) > at groovy.lang.GroovyShell.parse(GroovyShell.java:560) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:444) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:483) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:454) > at groovytest.Testtest.main(Testtest.java:19) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)