Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.0
-
None
-
Red Hat Enterprise Linux Server release 5.6, Sun JDK build 1.6.0_26-b03
Description
In a Groovlet:
We have a function to map "stuff" to a boolean:
boolean mapBoolean(def datum, boolean defaultValue) { ...... return res }
Immediately after the above in the Groovlet source, the function is tested:
assert mapBoolean(null, false) == false assert mapBoolean(null, null) == false
One would expect the compiler to generate an error as 'null' cannot be passed as second parameter.
But the asserts above are accepted and pass!
If one removes the first assert and changes to solely
assert mapBoolean(null, null) == false
THEN the compiler generates an error:
message GroovyServlet Error: script: 'foo': Script processing failed.No signature of method: com.mplify.interact.InspectMsg.mapBoolean() is applicable for argument types: (null, null) values: [null, null] Possible solutions: mapBoolean(java.lang.Object, boolean), asBoolean()org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:54)
A totally bared-down test "Simple.groovy" would be:
boolean mapBoolean(def datum, boolean defaultValue) { return false } if (params['run']) { assert mapBoolean(null, false) == false } assert mapBoolean(null, null) == false html.html { head { title "Testing" } body { div "PASSED" } }
Called with Simple.groovy?run=true ---> PASSED
Called with Simple.groovy ---> Script processing failed.No signature of method: Simple.mapBoolean() is applicable for argument types: (null, null)