Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3332

The groovy.time.*Duration classes make use of java.sql.Date

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6-rc-2
    • Fix Version/s: 2.2.0-beta-1
    • Component/s: groovy-jdk
    • Labels:
      None

      Description

      The groovy.time.*Duration classes make use of java.sql.Date, but there seems to be no justification for doing so.

      java.sql.Date is basically the same as java.util.Date except for the toString() formatting. So the second assert fails while the first assert succeeds:

      use (org.codehaus.groovy.runtime.TimeCategory) {
      
       Date dt1 = 0.days.from.now
       Date dt2 = new Date(0.days.from.now.time)
      
       assert dt1 == dt2
       assert dt1.toString() == dt2.toString() 
      }
      

        Attachments

        1. Groovy3332Bug.groovy
          0.4 kB
          Brad Long
        2. groovy-3332.patch
          1 kB
          Brad Long

          Issue Links

            Activity

              People

              • Assignee:
                pschumacher Pascal Schumacher
                Reporter:
                veita Alexander Veit
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: