gerrit/gerrit-gwtui
David Ostrovsky 2a107d74a1 FormatUtil: Fix Math#round() truncation error flagged by error-prone
Building with Bazel@HEAD: [1] is failing with this error message:

  FormatUtil.java:129: error: [MathRoundIntLong] Math.round(Integer) results in truncation
  | int p = Math.abs(Math.round(delta * 100 / size));
  | ^
  | (see https://errorprone.info/bugpattern/MathRoundIntLong)
  | Did you mean 'int p = Math.abs(Ints.saturatedCast(delta * 100 / size));'?

To rectify, replace Math.round() with Ints.saturatedCast() and borrow
this method from Guava library because Guava cannot be currently used in
GWT client code.

[1] https://github.com/bazelbuild/bazel/issues/5944
Change-Id: I1c88102d4d027796594fb7cdcde4f0ec4921d4ad
2018-08-22 07:42:37 +02:00
..
src FormatUtil: Fix Math#round() truncation error flagged by error-prone 2018-08-22 07:42:37 +02:00
BUILD Format WORKSPACE and BUILD files with buildifier version 0.12.0 2018-06-14 15:34:39 +09:00