You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ShaoXian Song (JIRA)" <ji...@apache.org> on 2018/12/28 01:36:00 UTC
[jira] [Created] (GROOVY-8941) Groovy DSL non-deterministic
behavior
ShaoXian Song created GROOVY-8941:
-------------------------------------
Summary: Groovy DSL non-deterministic behavior
Key: GROOVY-8941
URL: https://issues.apache.org/jira/browse/GROOVY-8941
Project: Groovy
Issue Type: Bug
Components: Groovy Console
Affects Versions: 2.5.2
Environment: jdk: oracle jdk 1.8.0_191
groovy: 2.5.2
os: windows
Reporter: ShaoXian Song
I'm using groovyConsole to see the generated class code of the following two Groovy scripts:
{code:java}
process test{
output:
file 'output.txt' into b, c
"""
echo hello
"""
}
{code}
Here is its generated code snippet like below:
{code:java}
public java.lang.Object run() {
this.process(this.test({
this.file('output.txt').into(b, c)
'\n echo hello\n '
}))
}
{code}
And here is the second script that differs from the previous one - this one uses parentheses in file() method invocation:
{code:java}
process test{
output:
file('output.txt') into b, c
"""
echo hello
"""
}
{code}
And this is generated code from the second script:
{code:java}
public java.lang.Object run() {
process.test({
this.file('output.txt').into(b, c)
'\n echo hello\n '
})
}
{code}
As you can see, {{process}} is no longer a function but a variable. It confuses me because I would expect that in both cases {{process}} should be seen as a function call. Is this an expected behavior? Do I miss something?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)