groovy

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.

Issue Links

Activity

Hide
Jeff Brown added a comment -

I have attached a patch including a simple test case.

Show
Jeff Brown added a comment - I have attached a patch including a simple test case.
Hide
Jeff 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 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

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: