Groovy
  1. Groovy
  2. GROOVY-2746

Static import of method with default parameter value: MissingMethodException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.4
    • Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None
    • Environment:
      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

      1. 2746_v15x_v2.diff
        2 kB
        Roshan Dawrani
      2. 2746_v16x_v2.diff
        2 kB
        Roshan Dawrani
      3. 2746_v17x_v2.diff
        2 kB
        Roshan Dawrani

        Issue Links

          Activity

          Ivan Dolvich created issue -
          Guillaume Delcroix made changes -
          Field Original Value New Value
          Fix Version/s 1.6-beta-1 [ 14008 ]
          Guillaume Delcroix made changes -
          Fix Version/s 1.6-beta-1 [ 14008 ]
          Fix Version/s 1.6-beta-2 [ 14261 ]
          Guillaume Delcroix made changes -
          Fix Version/s 1.6-beta-2 [ 14261 ]
          Fix Version/s 1.6-rc-1 [ 14009 ]
          Guillaume Delcroix made changes -
          Fix Version/s 1.5.8 [ 14630 ]
          Fix Version/s 1.7 [ 14014 ]
          Roshan Dawrani made changes -
          Attachment 2746Patch.zip [ 38028 ]
          Roshan Dawrani made changes -
          Attachment 2746Patch.zip [ 38028 ]
          Roshan Dawrani made changes -
          Attachment 2746_v15x_v2.diff [ 38336 ]
          Attachment 2746_v16x_v2.diff [ 38337 ]
          Attachment 2746_v17x_v2.diff [ 38338 ]
          Roshan Dawrani made changes -
          Attachment 2746_v17x_v2.diff [ 38338 ]
          Roshan Dawrani made changes -
          Attachment 2746_v17x_v2.diff [ 38344 ]
          Jochen Theodorou made changes -
          Assignee Jochen Theodorou [ blackdrag ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          Guillaume Delcroix made changes -
          Link This issue is depended upon by GROOVY-4613 [ GROOVY-4613 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
          Mark Thomas made changes -
          Workflow jira [ 12731770 ] Default workflow, editable Closed status [ 12743589 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
          Mark Thomas made changes -
          Workflow jira [ 12969735 ] Default workflow, editable Closed status [ 12977477 ]

            People

            • Assignee:
              Jochen Theodorou
              Reporter:
              Ivan Dolvich
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development