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

Can't call statically imported method with named arguments

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.1
    • 1.6.2, 1.7-beta-1
    • None
    • None
    • Windows XP, JDK 6 u13

    Description

      Problem in mapping the method call correctly to one of the statically imported methods.
      The case:
      In TestFunc.groovy:

      package test;

      public class TestFunc {

      def static func(arg)

      { println arg.getClass(); }

      }

      and in another source (main.groovy):

      import static test.TestFunc.*;

      def hmap = [ text: 'Text', value: 1 ]
      func hmap // this works
      func ([text: 'Some text', value: 1]) // also OK
      func text: 'Some text', value: 1 // but this throws exception

      Output:
      class java.util.LinkedHashMap
      class java.util.LinkedHashMap
      Caught: groovy.lang.MissingMethodException: No signature of method: main.func()
      is applicable for argument types: (java.util.LinkedHashMap) values: [[text:Some
      text, value:1]]
      at main.run(main.groovy:6)

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            bartec Krzysztof Barteczko
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: