gerrit/gerrit-gwtui/src
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
..
main/java FormatUtil: Fix Math#round() truncation error flagged by error-prone 2018-08-22 07:42:37 +02:00
test/java/com/google/gerrit/client/diff Format all Java files with google-java-format 2017-02-07 10:04:39 +09:00