Avoid work in Optional.orElse() calls Any code inside the orElse() will always be called, even if the result isn't used because the optional is present. This is wasteful at a minimum and can be actively harmful (as seen in [1]) because of side effects or performance impacts. Fix that by replacing all orElse() calls that create new instances or do non-constant work with a call to orElseGet(). It would be nice if there were an ErrorProne checker for this, but one doesn't exist yet. [1] https://gerrit-review.googlesource.com/c/gerrit/+/417915/comment/0ea287cd_bfecb7f2/ Release-Notes: skip Change-Id: I2d3d59da88cd04a2e589b7255fc0877719a57432
Gerrit web-based plugin manager.
To enable this plugin, please look at the configuration guide