Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 2.0-beta-3
-
Fix Version/s: None
-
Component/s: Compiler
-
Labels:None
-
Environment:Debian Unstable, OpenJDK 7, Groovy master/HEAD
-
Number of attachments :
Description
The script:
def theMessage ( a , b = ' ' , c , d = '.' ) {
a + b + c + d
}
println theMessage ( 'Hello' )
results in the error message:
groovy.lang.MissingMethodException: No signature of method: ConsoleScript0.theMessage() is applicable for argument types: (java.lang.String) values: [Hello]
Possible solutions: theMessage(java.lang.Object, java.lang.Object), theMessage(java.lang.Object, java.lang.Object, java.lang.Object), theMessage(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at ConsoleScript0.run(ConsoleScript0:5)
...
which is understandable, and not incorrect, but isn't perhaps as helpfully user oriented as perhaps it could be.
Do you have a suggestion for what you might like to have seen for this case? Is your main point that giving the options where defaults values could be used just adds noise?