[ 
https://issues.apache.org/jira/browse/WICKET-1669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12601174#action_12601174
 ] 

Thomas Mäder commented on WICKET-1669:
--------------------------------------

Doing the class check like this:

if (that instanceof TimeFrame)
 
will break the contract of the equals(Object) method. I.E. in the presence of 
subclasses it may be that this.equals(that) != that.equals(this). 

I realize that the class is final, but I find the following safer:

if (that == null || that.getClass() != getClass) {
    return false,
}

As far as performance is concerned, I would venture that a modern JIT generates 
the exact same code, unless there are subclasses, where the latter version 
becomes faster.

> TimeFrame.equals(Object)  does not work as expected
> ---------------------------------------------------
>
>                 Key: WICKET-1669
>                 URL: https://issues.apache.org/jira/browse/WICKET-1669
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.2, 1.3.3, 1.4-M1
>         Environment: all
>            Reporter: Rodolfo Hansen
>            Priority: Minor
>         Attachments: TimeFrameEquals.txt
>
>   Original Estimate: 0.33h
>  Remaining Estimate: 0.33h
>
> the equals() method should be implemented for the TimeFrame class

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

Reply via email to