You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sean Mickey (JIRA)" <ji...@apache.org> on 2010/06/28 20:13:50 UTC

[jira] Created: (LANG-628) Javadoc for HashCodeBuilder.append(boolean) does not match implementation.

Javadoc for HashCodeBuilder.append(boolean) does not match implementation.
--------------------------------------------------------------------------

                 Key: LANG-628
                 URL: https://issues.apache.org/jira/browse/LANG-628
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.*
            Reporter: Sean Mickey
            Priority: Minor
             Fix For: 3.0


The Javadoc description for HashCodeBuilder.append(boolean) says that it "adds iConstant * 1 to the hashCode," however, the code is actually:
iTotal = iTotal * iConstant + (value ? 0 : 1). It is probably just a typo, but it easy to correct.

And the reference to hashCode handling in java.lang.Boolean:  "not a 1231 or 1237 as done in java.lang.Boolean" could be clarified with more detail. Otherwise, it requires going to the java.lang Javadoc and finding the java.lang.Boolean.hashCode Javadoc description.




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-628) Javadoc for HashCodeBuilder.append(boolean) does not match implementation.

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

Henri Yandell commented on LANG-628:
------------------------------------

I've updated the Javadoc with your text.

> Javadoc for HashCodeBuilder.append(boolean) does not match implementation.
> --------------------------------------------------------------------------
>
>                 Key: LANG-628
>                 URL: https://issues.apache.org/jira/browse/LANG-628
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>            Reporter: Sean Mickey
>            Priority: Minor
>             Fix For: 3.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The Javadoc description for HashCodeBuilder.append(boolean) says that it "adds iConstant * 1 to the hashCode," however, the code is actually:
> iTotal = iTotal * iConstant + (value ? 0 : 1). It is probably just a typo, but it easy to correct.
> And the reference to hashCode handling in java.lang.Boolean:  "not a 1231 or 1237 as done in java.lang.Boolean" could be clarified with more detail. Otherwise, it requires going to the java.lang Javadoc and finding the java.lang.Boolean.hashCode Javadoc description.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-628) Javadoc for HashCodeBuilder.append(boolean) does not match implementation.

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

Sean Mickey commented on LANG-628:
----------------------------------

Here is a copy of the javadoc I included in the hashCode patch I created for LANG-411 to include information about the java.lang.Boolean handling:

<p>
* This is in contrast to out-of-the-box <code>java.lang.Boolean.hashCode</code> handling, which computes
* a <code>hashCode</code> value of <code>1231</code> for <code>java.lang.Boolean</code> instances
* that represent <code>true</code> or <code>1237</code> for <code>java.lang.Boolean</code> instances
* that represent <code>false</code>.
* </p>

It doesn't seem to warrant reopening the issue, however, if you agree that this added javadoc is useful, I guess it would be a quick reopen and close to add this bit of content. I will be happy to reopen the issue and create a patch with the additional javadoc if you like.

> Javadoc for HashCodeBuilder.append(boolean) does not match implementation.
> --------------------------------------------------------------------------
>
>                 Key: LANG-628
>                 URL: https://issues.apache.org/jira/browse/LANG-628
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>            Reporter: Sean Mickey
>            Priority: Minor
>             Fix For: 3.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The Javadoc description for HashCodeBuilder.append(boolean) says that it "adds iConstant * 1 to the hashCode," however, the code is actually:
> iTotal = iTotal * iConstant + (value ? 0 : 1). It is probably just a typo, but it easy to correct.
> And the reference to hashCode handling in java.lang.Boolean:  "not a 1231 or 1237 as done in java.lang.Boolean" could be clarified with more detail. Otherwise, it requires going to the java.lang Javadoc and finding the java.lang.Boolean.hashCode Javadoc description.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LANG-628) Javadoc for HashCodeBuilder.append(boolean) does not match implementation.

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

Henri Yandell closed LANG-628.
------------------------------

    Resolution: Fixed

I've dropped the 'iConstant *' part. None of the other appends cover that. I've noted that you have to check the java.lang.Boolean javadoc for the 1231/1237 part - I'm not sure what other detail could be offered; feel free to propose anything if you can think of what you'd like to see there.

I've added the following to the class javadoc:

+ * The following is the approach taken. When appending a data field, the current total is multiplied by the 
+ * multiplier then a relevant value 
+ * for that data type is added. For example, if the current hashCode is 17, and the multiplier is 37, then 
+ * appending the integer 45 will create a hashcode of 674, namely 17 * 37 + 45. 

Please reopen if you think more should be done.



> Javadoc for HashCodeBuilder.append(boolean) does not match implementation.
> --------------------------------------------------------------------------
>
>                 Key: LANG-628
>                 URL: https://issues.apache.org/jira/browse/LANG-628
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>            Reporter: Sean Mickey
>            Priority: Minor
>             Fix For: 3.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The Javadoc description for HashCodeBuilder.append(boolean) says that it "adds iConstant * 1 to the hashCode," however, the code is actually:
> iTotal = iTotal * iConstant + (value ? 0 : 1). It is probably just a typo, but it easy to correct.
> And the reference to hashCode handling in java.lang.Boolean:  "not a 1231 or 1237 as done in java.lang.Boolean" could be clarified with more detail. Otherwise, it requires going to the java.lang Javadoc and finding the java.lang.Boolean.hashCode Javadoc description.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.