commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Sawle (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LANG-780) add public org.apache.commons.lang.builder.HashCodeBuilder append(Enum value) to HashCodeBuilder
Date Thu, 09 Oct 2014 22:52:34 GMT

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

James Sawle updated LANG-780:
-----------------------------
    Attachment: LANG-780.patch

Patch for enum support in HashCodeBuilder.

Using the Enum's class name and value name separated by a '.' to cover the concerns. This
should mean that two different Enums that use the same value names do not clash. This will
also give consistency across JVMs/different runs, even though the contract does not require
it.

> add  public org.apache.commons.lang.builder.HashCodeBuilder append(Enum value) to HashCodeBuilder

> --------------------------------------------------------------------------------------------------
>
>                 Key: LANG-780
>                 URL: https://issues.apache.org/jira/browse/LANG-780
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.builder.*
>    Affects Versions: 2.5
>            Reporter: Alex Pokotilo
>             Fix For: Patch Needed
>
>         Attachments: LANG-780.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Since Enum's hashCode return different values between calls this can cause different
values if enum appended to HashCodeBuilder 
> IMHO adding append for enum would be enough to solve this entirely
> public org.apache.commons.lang.builder.HashCodeBuilder append(Enum value)
> {
>  append(value.name().hashCode());
>  return this;
> }



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

Mime
View raw message