[ 
https://issues.apache.org/jira/browse/GROOVY-7933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15500336#comment-15500336
 ] 

ASF GitHub Bot commented on GROOVY-7933:
----------------------------------------

GitHub user jwagenleitner opened a pull request:

    https://github.com/apache/groovy/pull/424

    GROOVY-7933: fix method selection for boolean and char primitives

    boolean and char were not factored into the primitive distance tables which
    would cause methods with Object to be selected in preference to those
    with boolean/char and their respective Wrapper.
    
    Inserted `boolean` and `char` (and their wrappers) in the distance table 
and kept all distances the same for the existing classes in the table (adding 
boolean and char as the farthest dist from the existing classes).
    
    Had to fix one test because `HashCodeHelper` has overloaded methods and 
prior to this change it was selecting the method with `Object` instead of 
`boolean`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jwagenleitner/groovy GROOVY-7933

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/424.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #424
    
----
commit 156d3f72db9e80db6f62bdc3829f2d3767c9544e
Author: John Wagenleitner <jwagenleit...@apache.org>
Date:   2016-09-18T05:41:06Z

    GROOVY-7933: fix method selection for boolean and char primitives
    
    boolean and char were not factored into the primitive distance tables which
    would cause methods with Object to be selected in preference to those
    with boolean/char and their respective Wrapper.

----


> Incorrect boxing of boolean primitive types
> -------------------------------------------
>
>                 Key: GROOVY-7933
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7933
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.7
>            Reporter: Henri Tremblay
>
> A boolean primitive type seems to be boxed for no apparent reason. See the 
> example below. The problem disappear when using @CompileStatic or if 
> explicitly casting to (boolean).
> {code:java}
> public class Demo {
>    public void a(boolean a){
>        System.out.println("boolean was called");
>    }
>    public void a(Object a){
>        System.out.println("Object was called");
>    }
> }
> class Groovy {
>    static void main(String[] args) {
>        def demo = new Demo()
>        demo.a(true)
>    }
> }
> {code}
> *Output:*
> Object was called



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to