Resolution: Out of Scope
Affects Version/s: None
Fix Version/s: None
Scala: scala-library v 2.10.4
Wile constructing Tuple6 inside lambda I'm observing null value passing into the Tuple instead on not null value. This issue occurs only on "warmed-up" JVM after hot spots compilations, which is resulting in hardly trackable, not always reproducible bugs.
Code snippet which causes issue is below:
The issue is that in resulting Set we may get Tuples with null values on third position, which is not possible since viewingPeriod is enum, where id is always not null value specified in constructor, and not modifiable.
Note: Issue is not reproduced if replace Collection.forEach with old style for expression.
Note: Issue is not reproduced if we replace Tuple with any Java Parametrized collection (Map for example)
Note: Issue is not reproduced if we disable JIT
Note: Issue is reproduced in random manner, and we noticed it is more often reproduced in case computer is running under load caused by some other tasks. We started build process for our project in parallel.
Test project: both sources and executable jar is in attachment.
How issue could be observed:
Just run attached executable jar using java -jar <jar name> and check output.
At some point it starts showing message like: Start reproducing: Thread <thread name> at step <step> res: <Tuple content, on which issue was detected>.
Here step - is step in loop on which issue starts reproducing.
Sometimes it is necessary to run application several times (up to 10-20 to get this error), we only notice it appears faster in case computer is working under load.