[ 
https://issues.apache.org/jira/browse/GROOVY-5399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jochen Theodorou resolved GROOVY-5399.
--------------------------------------
      Assignee: Jochen Theodorou
    Resolution: Won't Fix

With default methods on interfaces Java more and more adds methods to 
interfaces, that formerly would have gone in helper classes like Arrays and 
Collections. I still think adding these kind of methods to DGM on demand is 
better, but the need will probably also arise less. Thus it should be save to 
close this feature request

> Automatically provide instance methods on objects when another class has a 
> static method with the object as first argument
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-5399
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5399
>             Project: Groovy
>          Issue Type: New Feature
>          Components: Compiler
>            Reporter: Dr. Russel Winder
>            Assignee: Jochen Theodorou
>            Priority: Major
>
> The script:
> {code}
> number = 27
> println number.toHexString ( )
> {code}
> results in the message:
> {quote}
> 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)
> {quote}
> 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. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to