You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/08/07 01:29:00 UTC

[jira] [Comment Edited] (GROOVY-9674) Compilation error, when compiling code with excess parantheses

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

Paul King edited comment on GROOVY-9674 at 8/7/20, 1:28 AM:
------------------------------------------------------------

I noticed something close to this myself just 30 mins ago. I'd guess it thinks you are trying to create a cast expression. We need to investigate. My example:
{code}
(System.getProperties())['java.version'] // => works
(System.properties)['java.version'] // => unable to resolve class System.properties
{code}
But I get the same behavior in 2.5 and 3.0.


was (Author: paulk):
I noticed this myself just 30 mins ago. It thinks you are trying to create a cast expression. We need to investigate.

> Compilation error, when compiling code with excess parantheses
> --------------------------------------------------------------
>
>                 Key: GROOVY-9674
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9674
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 3.0.5
>         Environment: Openjdk version "11.0.8" 2020-07-14
> OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
> OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)
>            Reporter: Olaf Krische
>            Priority: Major
>
> I have two formulas, and both are equivalent (to me at least).
> String formula1 = "var_00000 - (var_group_combined_or - var_00000)";
> String formula2 = "var_00000 - ((var_group_combined_or) - var_00000)";
> With Groovy 2.5 it compiles, starting with Groovy3 i get compile exception, when doing this in Java:
> {code:java}
> GroovyShell SHELL = new GroovyShell();
> Script parse1 = SHELL.parse(String.format("closure={%s}", formula1)); 
> Script parse2 = SHELL.parse(String.format("closure={%s}", formula2)); 
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Script2.groovy: 1: unable to resolve class var_group_combined_or
>  @ line 1, column 22.
>    closure={var_00000 - ((var_group_combined_or) - var_00000)}
> {code}
> Is this a bug on my side or is there some misunderstanding with the spec on my side?
> Thank you!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)