You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Matt Benson (JIRA)" <ji...@apache.org> on 2011/04/03 18:48:07 UTC

[jira] [Created] (LANG-688) Proposed code simplifications for BooleanUtils

Proposed code simplifications for BooleanUtils
----------------------------------------------

                 Key: LANG-688
                 URL: https://issues.apache.org/jira/browse/LANG-688
             Project: Commons Lang
          Issue Type: Improvement
          Components: lang.*
    Affects Versions: 3.0
            Reporter: Matt Benson
            Assignee: Matt Benson
            Priority: Minor
             Fix For: 3.0


Patch forthcoming for team consideration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (LANG-688) Proposed code simplifications for BooleanUtils

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson resolved LANG-688.
------------------------------

    Resolution: Fixed

> Proposed code simplifications for BooleanUtils
> ----------------------------------------------
>
>                 Key: LANG-688
>                 URL: https://issues.apache.org/jira/browse/LANG-688
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.0
>            Reporter: Matt Benson
>            Assignee: Matt Benson
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-688.patch.txt
>
>
> Patch forthcoming for team consideration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (LANG-688) Proposed code simplifications for BooleanUtils

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13016704#comment-13016704 ] 

Henri Yandell commented on LANG-688:
------------------------------------

There seem to three types of change:

1) Removing lots of pointless tenerary operators. 
2) Removing else blocks to match the local code style.
3) Removing ternary operators and relying on autoboxing of boolean to Boolean.

The first two are fine, I don't care on #2 but if you do then go for it. #3 feels a bit weird, but I think it's fine. 

Gotta wonder why we have BooleanUtils.isTrue(Boolean). Seems like there are a bunch of methods we can remove in BooleanUtils with the answer of 'use autoboxing'. 


> Proposed code simplifications for BooleanUtils
> ----------------------------------------------
>
>                 Key: LANG-688
>                 URL: https://issues.apache.org/jira/browse/LANG-688
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.0
>            Reporter: Matt Benson
>            Assignee: Matt Benson
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-688.patch.txt
>
>
> Patch forthcoming for team consideration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (LANG-688) Proposed code simplifications for BooleanUtils

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13016863#comment-13016863 ] 

Matt Benson commented on LANG-688:
----------------------------------

Thanks for the comments; I have committed the changes, minus the autoboxing:

revision 1089904
[LANG-688] removed unnecessary elses and use of ternary operator with primitive boolean consequences e.g. (some boolean expression) ? true : false


> Proposed code simplifications for BooleanUtils
> ----------------------------------------------
>
>                 Key: LANG-688
>                 URL: https://issues.apache.org/jira/browse/LANG-688
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.0
>            Reporter: Matt Benson
>            Assignee: Matt Benson
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-688.patch.txt
>
>
> Patch forthcoming for team consideration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (LANG-688) Proposed code simplifications for BooleanUtils

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13016727#comment-13016727 ] 

Stephen Colebourne commented on LANG-688:
-----------------------------------------

isTrue(Boolean) handles null

> Proposed code simplifications for BooleanUtils
> ----------------------------------------------
>
>                 Key: LANG-688
>                 URL: https://issues.apache.org/jira/browse/LANG-688
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.0
>            Reporter: Matt Benson
>            Assignee: Matt Benson
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-688.patch.txt
>
>
> Patch forthcoming for team consideration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (LANG-688) Proposed code simplifications for BooleanUtils

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13016813#comment-13016813 ] 

Sebb commented on LANG-688:
---------------------------

I'm not keen on allowing auto-boxing as it has some disadvantages. 
For example, hiding the conversions means it's not so obvious when the code is doing unnecessary work, e.g. accidentally mixing the types.

And it can cause some unexpected behaviour (admittedly not with boolean), see [1]

For code that is written once and used by many, I think it's much safer to always use explicit boxing and unboxing.

[1] http://www.jibble.org/news/?period=2005-12&id=1135198746

> Proposed code simplifications for BooleanUtils
> ----------------------------------------------
>
>                 Key: LANG-688
>                 URL: https://issues.apache.org/jira/browse/LANG-688
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.0
>            Reporter: Matt Benson
>            Assignee: Matt Benson
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-688.patch.txt
>
>
> Patch forthcoming for team consideration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (LANG-688) Proposed code simplifications for BooleanUtils

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson updated LANG-688:
-----------------------------

    Attachment: LANG-688.patch.txt

> Proposed code simplifications for BooleanUtils
> ----------------------------------------------
>
>                 Key: LANG-688
>                 URL: https://issues.apache.org/jira/browse/LANG-688
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.0
>            Reporter: Matt Benson
>            Assignee: Matt Benson
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-688.patch.txt
>
>
> Patch forthcoming for team consideration.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira