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

static import of method with default parameter value broken again: MissingMethodException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.4
    • 1.7.6
    • None
    • None
    • Java 1.6, Ubuntu and Windows XP

    Description

      A static method with a default parameter is not found, when it is imported statically and called without prefixing his class:

      test.groovy
      import static Settings.*
      import static ConsoleUI.*
      
      class Settings
      {
          static void initialize() {
              writeln("working", 100)
              writeln("failing")
          }
      }
      
      class ConsoleUI
      {
          static void writeln(String s, int delay = 0) {
              sleep delay
              println s
          }
      }
      
      Settings.initialize()
      

      Output:

      working
      Caught: groovy.lang.MissingMethodException: No signature of method: static Settings.writeln() is applicable for argument types: (java.lang.String) values: {"failing"}
      	at Settings.initialize(test.groovy:8)
      	at test.run(test.groovy:20)
      	at test.main(test.groovy)
      
      Exited: 256
      

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              avalon A
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: