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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6-rc-2
    • 2.2.0-beta-1
    • groovy-jdk
    • 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. groovy-3332.patch
          1 kB
          Brad Long
        2. Groovy3332Bug.groovy
          0.4 kB
          Brad Long

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: