Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.1-beta-2
-
Fix Version/s: 1.1-rc-1
-
Component/s: groovy-jdk
-
Labels:None
-
Environment:red hat linux
-
Number of attachments :
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)
>
>
>
>
ok, after looking into this I found the reason... at the point the ResolveVisitor finds the static import the class is not yet parsed. Which means finding the static method must be done at a later step than it is currently done.