codeconsole opened a new pull request, #3255:
URL: https://github.com/apache/groovy/pull/3255

   https://issues.apache.org/jira/browse/GROOVY-12721
   
   `Awaitable.all`, `any`, `first` and `allSettled` take `Object... sources`. A 
list of tasks, the usual shape when they come out of `collect`, had to be 
spread (`Awaitable.allSettled(*tasks)`); passing the list itself compiled and 
failed at run time with "No Awaitable adapter found for type: 
java.util.ArrayList". That is the form JavaScript's `Promise.all(iterable)` 
taught, and the one a model with the Groovy docs in front of it still wrote.
   
   A collection is never awaitable, so a single `Collection` argument has no 
other meaning. `AwaitCombinators` now takes such an argument's elements as the 
sources, for the four async combinators and so for the blocking forms that 
delegate to them; the empty and null checks of `any` and `first` apply to those 
elements. The spread form keeps working.
   
   ```groovy
   def tasks = ['a', 'b', 'c'].collect { m -> async { fetch(m) } }
   def results = await Awaitable.allSettled(tasks)
   ```
   
   Docs: a tip in the combinator summary of `core-async-await.adoc`, and the 
`@param sources` lines of the four methods. Tests: 
`AsyncAwaitTest.testCombinatorsTakeOneListOfSources` (list and set, empty list, 
the four combinators, the empty and null rejections). Also run locally: 
`groovy.AsyncAwaitTest` and `org.apache.groovy.runtime.async.*`, 370 tests, 
passing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to