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

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

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-5, 1.0-JSR-6
    • 1.1-beta-1
    • groovy-jdk
    • 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. TestUseReturnValue.groovy
          0.5 kB
          Edward Povazan
        2. categoryReturnValuePatch.txt
          4 kB
          Jeff Brown

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: