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

MissingMethodException when trying to resolve overload with variable arguments

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.5.5
    • 2.5.6, 3.0.0-beta-1
    • None
    • None
    • Windows

    Description

      Minimal script to reproduce the issue:

      #!/usr/bin/env groovy
      
      class Example {
      
          void method(String... args) {
          }
      
          static void method(List<String> args, File workDirectory, Appendable out, Appendable err) {
          }
      
          void execute() {
              method("a", "b", "c", "d")
          }
      }
      
      Example ex = new Example()
      ex.execute()
      

      Running this script on Windows produces the following exception:

      Caught: groovy.lang.MissingMethodException: No signature of method: static Example.method() is applicable for argument types: (String, String, String, String) values: [a, b, c, d]
      Possible solutions: method([Ljava.lang.String;), method(java.util.List, java.io.File, java.lang.Appendable, java.lang.Appendable)
      groovy.lang.MissingMethodException: No signature of method: static Example.method() is applicable for argument types: (String, String, String, String) values: [a, b, c, d]
      Possible solutions: method([Ljava.lang.String;), method(java.util.List, java.io.File, java.lang.Appendable, java.lang.Appendable)
              at Example.execute(Hello.groovy:12)
              at Example$execute.call(Unknown Source)
              at Hello.run(Hello.groovy:17)
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              alexey.subach Alexey Subach
              Votes:
              1 Vote for this issue
              Watchers:
              2 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