mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-08 22:14:59 +00:00
Remove and forbid use of com.google.common.math.LongMath
This commit removes and now forbids all uses of com.google.common.math.LongMath across the codebase. This is one step of many in the eventual removal of Guava as a dependency.
This commit is contained in:
parent
ff4a11aa32
commit
7a29febd72
@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.elasticsearch.common.util;
|
package org.elasticsearch.common.util;
|
||||||
|
|
||||||
import com.google.common.math.LongMath;
|
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import org.apache.lucene.store.DataInput;
|
import org.apache.lucene.store.DataInput;
|
||||||
import org.apache.lucene.store.DataOutput;
|
import org.apache.lucene.store.DataOutput;
|
||||||
@ -33,7 +32,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||||||
import org.elasticsearch.common.unit.SizeValue;
|
import org.elasticsearch.common.unit.SizeValue;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
@ -321,7 +319,13 @@ public class BloomFilter {
|
|||||||
long bitCount;
|
long bitCount;
|
||||||
|
|
||||||
BitArray(long bits) {
|
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
|
// Used by serialization
|
||||||
|
@ -119,6 +119,7 @@ com.google.common.collect.UnmodifiableIterator
|
|||||||
com.google.common.collect.ObjectArrays
|
com.google.common.collect.ObjectArrays
|
||||||
com.google.common.collect.Multimap
|
com.google.common.collect.Multimap
|
||||||
com.google.common.collect.MultimapBuilder
|
com.google.common.collect.MultimapBuilder
|
||||||
|
com.google.common.math.LongMath
|
||||||
|
|
||||||
@defaultMessage Do not violate java's access system
|
@defaultMessage Do not violate java's access system
|
||||||
java.lang.reflect.AccessibleObject#setAccessible(boolean)
|
java.lang.reflect.AccessibleObject#setAccessible(boolean)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user