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

Henri Tremblay commented on GROOVY-7933:
----------------------------------------

It think it should be fixed indeed. At least for one reason: Right now you have 
a different behavior between @CompileStatic and interpreted code. That doesn't 
make sense.

On my side, the issue would currently force me to add an overload dedicated to 
Groovy. Normally, in Java we need `foo(boolean)` and `foo(Object)`. This would 
also for me to add a `foo(Boolean)` to please Groovy. It seems sad for 
interoperability.

> 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