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

[jira] [Created] (GROOVY-9691) Method call "main" is replaced with StaticMethodCallExpression in script

Eric Milles created GROOVY-9691:
-----------------------------------

             Summary: Method call "main" is replaced with StaticMethodCallExpression in script
                 Key: GROOVY-9691
                 URL: https://issues.apache.org/jira/browse/GROOVY-9691
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles


Consider the following Gradle build script snippet:
{code:groovy}
sourceSets {
    main {
        java { srcDirs = [] }
        groovy { srcDirs = ['src/main'] }
    }
    test {
        java { srcDirs = [] }
        groovy { srcDirs = ['src/test'] }
    }
}
{code}

When opened in an editor, Groovy transforms "main" to a reference to "static void main(String[])".  This negatively impacts the editing experience because Closure is not a match for String and the IDE gets quite confused.

This applies to any script (or class with a static main method) that uses "main" as a method call within a closure.



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