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

use(category, closure) should return the closures return value.

    Details

    • Type: Wish
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-JSR-5, 1.0-JSR-6
    • Fix Version/s: 1.1-beta-1
    • Component/s: groovy-jdk
    • Labels:
      None

      Description

      use(StringCategory) {
      return "hello".capitalize()
      }
      returns null (use is a void method). However a closure call always returns Object. In keeping with the element of least surprise, use() should return the closures return value.

        Attachments

        1. categoryReturnValuePatch.txt
          4 kB
          Jeff Brown
        2. TestUseReturnValue.groovy
          0.5 kB
          Edward Povazan

          Issue Links

            Activity

              People

              • Assignee:
                blackdrag Jochen Theodorou
                Reporter:
                emp Edward Povazan
              • Votes:
                1 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: