incubator-heron icon indicating copy to clipboard operation
incubator-heron copied to clipboard

fix rounding error failing build

Open sreev opened this issue 7 years ago • 2 comments

ERROR: /Users/svaddi/SreeVaddi/source/github/sreev/incubator-heron/heron/common/src/java/BUILD:11:1: Building heron/common/src/java/libbasics-java.jar (13 source files) failed (Exit 1)
heron/common/src/java/org/apache/heron/common/basics/ByteAmount.java:28: error: [MathRoundIntLong] Math.round(Integer) results in truncation
  private static final long MAX_MB = Math.round(Long.MAX_VALUE / MB);
                                               ^
    (see https://errorprone.info/bugpattern/MathRoundIntLong)
  Did you mean 'private static final long MAX_MB = Ints.saturatedCast(Long.MAX_VALUE / MB);'?
heron/common/src/java/org/apache/heron/common/basics/ByteAmount.java:29: error: [MathRoundIntLong] Math.round(Integer) results in truncation
  private static final long MAX_GB = Math.round(Long.MAX_VALUE / GB);
                                               ^
    (see https://errorprone.info/bugpattern/MathRoundIntLong)
  Did you mean 'private static final long MAX_GB = Ints.saturatedCast(Long.MAX_VALUE / GB);'?
INFO: Elapsed time: 198.003s, Critical Path: 137.34s
INFO: 454 processes: 446 local, 8 worker.
FAILED: Build did NOT complete successfully

sreev avatar Oct 15 '18 11:10 sreev

attached the patch:

issue-3046.patch.txt

sreev avatar Oct 16 '18 08:10 sreev

LGTM

thinker0 avatar Nov 03 '18 01:11 thinker0