Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.4
-
Fix Version/s: 1.7.6
-
Component/s: None
-
Labels:None
-
Environment:Java 1.6, Ubuntu and Windows XP
-
Testcase included:yes
-
Number of attachments :
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
Issue Links
- depends upon
-
GROOVY-2746
Static import of method with default parameter value: MissingMethodException
-
This is a clone of
GROOVY-2746I couldn't reopen it and cannot edit this issue any more so I'm writing relevant information in this comment.
Basically the same issue is back in groovy 1.7.5
When I use 1.7.1 I can use a statically imported method with default parameters but with 1.7.5 I need to use the full qualified name /e.g. MyClass.myMethod(x,y,z)/.