Closed vlsi closed 1 year ago
The open question for me is: When is it worth using for loops instead of streams while blow up the code at the same time.
Technically speaking, you could use the previous containerCollector(), so the code would be of the same length
I think it should be fine to go for regular for loops in hot paths, especially, when the for loop is trivial. I would expect that arbitrary, generators, shinkers, and store would be on the hot paths.
For instance, in this change, you remove 4 lines, and replace them with 4-line-long for loop. IDEA does the transformation both ways, so if you ever want adding extra spice on top of the for loop, you can auto-replace it with stream in IDEA
My IDEA did not offer a for loop replacement for ShrinkableContainer.createValue()
, and neither did Copilot suggest working code.
Ah, looks like I was wrong, and custom collectors block autoreplacement.
Testing Problem
java.util.stream
frames are unreadable, and it makes it harder to tell why the test has stuck.Sample stacktrace:
Suggested Solution
Rework
CombinedShrinkable.createValues
withfor
. The same fornet.jqwik.engine.properties.shrinking.ShrinkableContainer#createValue
.