On 5/5/16 2:22 PM, Eddie Aftandilian wrote:
FWIW, at Google we have a patch against our JDK that randomizes hash iteration
order. For test execution we randomize with a unique seed per JVM invocation.
For production we force a specific seed for all executions. This approach
catches most issues during automated testing, but reduces the likelihood of an
issue in production.
Yes, I've heard of such a thing.
From what I understand, this randomizes the iteration order of the *existing*
collections like HashMap. It makes sense for this to be an opt-in feature for
existing collections, since it seems pretty unwise to expose a behavioral change
to large quantities of existing code. Unfortunately, from time to time the JDK
does change the iteration order of the existing collections, and unsurprisingly,
lots of things break.
It would be interesting to see such a patch proposed for OpenJDK. It'd be good
to enable it during test runs, for a start.
s'marks