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

static imports not working with groovy classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1-beta-2
    • 1.1-rc-1
    • groovy-jdk
    • None
    • red hat linux

    Description

      Re: problem with static imports Click to flag this post

      by Paul King Jul 12, 2007; 05:47pm :: Rate this Message: (use ratings to moderate[?])

      Reply | Reply to Author | Show Only this Message

      Looks like a bug.

      If I follow the steps as you suggest I can replicate the error.
      If I add "groovyc com/test1/Runner.groovy" then I can invoke
      "groovy com/test1/Runner.groovy" with no problem.

      Please raise an issue.

      Paul.

      Jason Weden wrote:
      > Paul, thanks for your reply. That "static" keyword in the class definition
      > shouldn't have been in there. Could you tell me what's different between
      > your setup and mine? It's still isn't working for me:
      >
      > [nvw384@ma34jasper sandbox]$ groovy -version
      > Groovy Version: 1.1-beta-2 JVM: 1.5.0_11-b03
      >
      > [nvw384@ma34jasper sandbox]$ less com/test1/Runner.groovy
      >
      > package com.test1
      >
      > import static com.test1.test2.Utils.*
      >
      > printMe('hello world');
      >
      > [nvw384@ma34jasper sandbox]$ less com/test1/test2/Utils.groovy
      > package com.test1.test2
      >
      > class Utils {
      > static printMe (aString)

      { > println "$aString" > }

      > }
      >
      > [nvw384@ma34jasper sandbox]$ groovy com/test1/Runner.groovy
      > Caught: groovy.lang.MissingMethodException: No signature of method:
      > com.test1.Runner.printMe() is applicable for argument types:
      > (java.lang.String) values:

      {"hello world"}

      > at com.test1.Runner.run(Runner.groovy:6)
      > at com.test1.Runner.main(Runner.groovy)
      >
      >
      >
      >

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            jweden@motorola.com Jason Weden
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: