Merge pull request #13575 from jasontedor/long-math-be-gone

Remove and forbid use of com.google.common.math.LongMath
This commit is contained in:
Jason Tedor 2015-09-15 10:28:48 -04:00
commit b15cf5f708
2 changed files with 8 additions and 3 deletions

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.common.util;
import com.google.common.math.LongMath;
import com.google.common.primitives.Ints;
import org.apache.lucene.store.DataInput;
import org.apache.lucene.store.DataOutput;
@ -33,7 +32,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.SizeValue;
import java.io.IOException;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.Comparator;
@ -321,7 +319,13 @@ public class BloomFilter {
long bitCount;
BitArray(long bits) {
this(new long[Ints.checkedCast(LongMath.divide(bits, 64, RoundingMode.CEILING))]);
this(new long[size(bits)]);
}
private static int size(long bits) {
long quotient = bits / 64;
long remainder = bits - quotient * 64;
return Ints.checkedCast(remainder == 0 ? quotient : 1 + quotient);
}
// Used by serialization

View File

@ -119,6 +119,7 @@ com.google.common.collect.UnmodifiableIterator
com.google.common.collect.ObjectArrays
com.google.common.collect.Multimap
com.google.common.collect.MultimapBuilder
com.google.common.math.LongMath
@defaultMessage Do not violate java's access system
java.lang.reflect.AccessibleObject#setAccessible(boolean)