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

Infinite looping of closures with at least two patameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.0-JSR-2
    • 1.0-JSR-2
    • None
    • None
    • JDK 1.4.2 or JDK 1.5.0

    Description

      On the current CVS buid groovy-1.0-jsr-02-SNAPSHOT,
      there has been found an Infinite Looping Bug of closures with
      at least two parameters.
      Stack Overflows are produced, because of Infinite Looping Bug.

      Here is an example code for test:

      println "Testing a closure with one parameter:"
      def c1 =

      { x -> return (x + 1) }

      println c1(4) // work
      assert c1(4) == 5 // work

      println "Testing a closure with two parameters:"
      def c2 =

      { x, y -> return (x + y) }

      println c2(3, 4) // not work! infinite loop
      assert c2(3, 4) == 7 // not work! infinite loop

      println "Testing a closure with three parameters:"
      def c3 =

      { x, y, z -> return (x * y * z) }

      println c3(8, 9, 10) // not work! infinite loop
      assert c3(8, 9, 10) == 720 // not work! infinite loop

      Attachments

        Activity

          People

            phkim Kim, Pilho
            phkim Kim, Pilho
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: