gitgabrio opened a new issue, #6989:
URL: https://github.com/apache/incubator-kie/issues/6989

   The current implementation of ForIteration has the following details
   
   1. it use an underlying `Iterator` for its operations
   2. the `Iterator` is not instantiated immediately, but delegated to a 
`Supplier`
   3. the `iterator` is actually instantiated only when  `hasNextValue` is 
invoked
   4. if the underling `iterator.hasNext()` return false, then the iterator is 
set to `null`
   5. the `getNextValue()` does not instantiate the iterator by itself, so if 
the `hasNextValue()` has not been called before, it returns `null`
   6. the semantic is therefore different then the usual one provided by the 
`iterators` themselves
   
   A quick experiment, removing the supplier and using the class to simple 
"facade" of the underlying iterator, lead to test failuers; e.g.
   
   `"for x in [ 10, 20, 30 ], y in [ 1, 2, 3 ] return x * y"`
   -> 
   ```
   Expecting actual:
     [10, 20, 30]
   to contain exactly (and in same order):
     [10, 20, 30, 20, 40, 60, 30, 60, 90]
   but could not find the following elements:
     [20, 40, 60, 30, 60, 90]
   ```
   That could be the sympton that there is some existing logic, outside this 
class itself, that is based on the `null` object returned.
    


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to