Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: groovy-jdk
-
Labels:None
-
Number of attachments :
Description
The script:
number = 27 println number.toHexString ( )
results in the message:
Caught: groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.toHexString() is applicable for argument types: () values: []
Possible solutions: toHexString(int), toString(), toString(), toString(), toString(int), toString(int, int)
groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.toHexString() is applicable for argument types: () values: []
Possible solutions: toHexString(int), toString(), toString(), toString(), toString(int), toString(int, int)
at toHexString_Problem.run(toHexString_Problem.groovy:5)
The reason is that toHexString is defined as a static method on the types and not within the GroovyJDK. I believe that it is more usable for prograqmmers, more appropriate to a dynamic language, and generally more Groovy to allow the method to operate on a reference to an object and only raise an exception if the object is not of an appropriate type.