groovy
  1. groovy
  2. GROOVY-1287

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

    Details

    • Type: Wish Wish
    • Status: Closed Closed
    • Priority: Major 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
    • Testcase included:
      yes
    • Number of attachments :
      2

      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.

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

        Issue Links

          Activity

          Hide
          Jeff Scott Brown added a comment -

          I have attached a patch including a simple test case.

          Show
          Jeff Scott Brown added a comment - I have attached a patch including a simple test case.
          Hide
          Jeff Scott Brown added a comment -

          To clarify my last comment... The patch that I attached (categoryReturnValuePatch.txt) includes not only a test case but the code change as well.

          Show
          Jeff Scott Brown added a comment - To clarify my last comment... The patch that I attached (categoryReturnValuePatch.txt) includes not only a test case but the code change as well.
          Hide
          Guillaume Laforge added a comment -

          Jochen, could you have a look at this patch?

          Show
          Guillaume Laforge added a comment - Jochen, could you have a look at this patch?
          Hide
          Paul King added a comment -

          Should be fixed as result of fix to Groovy-1770 (basically a duplicate)

          Show
          Paul King added a comment - Should be fixed as result of fix to Groovy-1770 (basically a duplicate)

            People

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

              Dates

              • Created:
                Updated:
                Resolved: