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

Daniel Sun commented on GROOVY-5717:
------------------------------------

Fixed on master; added a regression test in 
795dd9a84d33be12c207067f15a7a0ac6ca568c6 
(https://github.com/apache/groovy/commit/795dd9a84d33be12c207067f15a7a0ac6ca568c6).

> Timestamp never equals java.sql.Date
> ------------------------------------
>
>                 Key: GROOVY-5717
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5717
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 1.7.8
>            Reporter: J. David Beutel
>            Assignee: Daniel Sun
>            Priority: Minor
>             Fix For: 7.0.0-alpha-1
>
>
> The second assertion fails, violating the principle of least surprise:
> {code}
> def s = new java.sql.Date(112, 8, 20)
> def t = new java.sql.Timestamp(s.time)
> assert s.equals(t)
> assert s == t
> {code}
> The problem seems to be that those two classes are siblings, not assignable 
> from each other, so DefaultTypeTransformation.compareToWithEqualityCheck() 
> never tries to compare them, although their equals method is compatible from 
> their common superclass, java.util.Date.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to