Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9691

Method call "main" is replaced with StaticMethodCallExpression in script

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0-alpha-1, 3.0.6
    • Component/s: None
    • Labels:
      None

      Description

      Consider the following Gradle build script snippet:

      sourceSets {
          main {
              java { srcDirs = [] }
              groovy { srcDirs = ['src/main'] }
          }
          test {
              java { srcDirs = [] }
              groovy { srcDirs = ['src/test'] }
          }
      }
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              emilles Eric Milles
              Reporter:
              emilles Eric Milles
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m