commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1147) EnumUtils *BitVector issue with more than 32 values Enum
Date Fri, 12 Jun 2015 23:39:00 GMT

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

ASF GitHub Bot commented on LANG-1147:
--------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/commons-lang/pull/97


> EnumUtils *BitVector issue with more than 32 values Enum
> --------------------------------------------------------
>
>                 Key: LANG-1147
>                 URL: https://issues.apache.org/jira/browse/LANG-1147
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.4
>            Reporter: Loic Guibert
>            Priority: Critical
>
> In *EnumUtils* all _BitVector_ related methods fail in handling Enums with more than
32 values.
> This is due to a implicit _int_ -> _long_ conversion in generating the Enum value
_long_ mask.
> *Bad code :* here *1* is an _int_ value so the *<<* operation is done into an _int_
context and then, the result is converted to a _long_ value
> {code}
> long mask = 1 << 32;    // -> mask = 1 and not 4294967296 (0x100000000)
> {code}
> *Good code :* here *1L* is a _long_ value so the *<<* operation is done into an
_long_ context
> {code}
> long mask = 1L << 32;    // -> mask = 4294967296 (0x100000000)
> {code}
> See PR#97 : https://github.com/apache/commons-lang/pull/97



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

Mime
View raw message