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

STC: Cannot choose between TimeDuration#plus(Duration) and Duration#plus(TimeDuration)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0, 4.0.6
    • 5.0.0-alpha-1
    • Static Type Checker
    • None

    Description

      Using org.codehaus.groovy:groovy-dateutil:

      import groovy.time.Duration
      import groovy.time.TimeDuration
      // GROOVY-10818
      @groovy.transform.TypeChecked
      Duration sum(TimeDuration td1, TimeDuration td2) {
        td1 + td2 // TimeDuration#plus(Duration) vs Duration#plus(TimeDuration)
      }
      sum(new TimeDuration(0, 1, 20, 43, 0), new TimeDuration(0, 0, 20, 17, 0))

       
      Compilation error:

      Reference to method is ambiguous. Cannot choose between [groovy.time.Duration groovy.time.TimeDuration#plus(groovy.time.Duration), groovy.time.Duration groovy.time.Duration#plus(groovy.time.TimeDuration)]
      

       

      Attachments

        Activity

          People

            emilles Eric Milles
            maicon.mauricio Maicon Mauricio
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: