groovy

Unable to use spread operator with maps

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.4
  • Fix Version/s: 1.5.5, 1.6-beta-1
  • Component/s: None
  • Labels:
    None
  • Environment:
    Groovy 1.5.4, Java 6
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

Try to run the following lines:

def map = [A:"one", B:"two", C:"three"]
  
  def list = map.collect { child ->  child.value.toUpperCase() }
  def list2 = map*.value?.toUpperCase()
  
  status.out.println list
  status.out.println list2

The first collect statement runs well. So, we expected the one which fills list2 to be equivalent.
But the result is not the same. After running the script, list2 becomes null.

Activity

Hide
Paul King added a comment -

fixed in trunk and merged onto the 1.5.x branch

Show
Paul King added a comment - fixed in trunk and merged onto the 1.5.x branch

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: