diff --git a/guava/src/com/google/common/hash/BloomFilter.java b/guava/src/com/google/common/hash/BloomFilter.java index 601e08300a29..241203506907 100644 --- a/guava/src/com/google/common/hash/BloomFilter.java +++ b/guava/src/com/google/common/hash/BloomFilter.java @@ -350,7 +350,7 @@ public int hashCode(@UnknownSignedness BloomFilter this) { * @since 23.0 */ public static Collector> toBloomFilter( - Funnel funnel, @Positive long expectedInsertions, @NonNegative double fpp) { + Funnel funnel, @Positive long expectedInsertions, double fpp) { checkNotNull(funnel); checkArgument( expectedInsertions >= 0, "Expected insertions (%s) must be >= 0", expectedInsertions); @@ -414,13 +414,13 @@ public int hashCode(@UnknownSignedness BloomFilter this) { * @since 19.0 */ public static BloomFilter create( - Funnel funnel, @Positive long expectedInsertions, @NonNegative double fpp) { + Funnel funnel, @Positive long expectedInsertions, double fpp) { return create(funnel, expectedInsertions, fpp, BloomFilterStrategies.MURMUR128_MITZ_64); } @VisibleForTesting static BloomFilter create( - Funnel funnel, @NonNegative long expectedInsertions, @NonNegative double fpp, Strategy strategy) { + Funnel funnel, @NonNegative long expectedInsertions, double fpp, Strategy strategy) { checkNotNull(funnel); checkArgument( expectedInsertions >= 0, "Expected insertions (%s) must be >= 0", expectedInsertions); @@ -436,7 +436,8 @@ public int hashCode(@UnknownSignedness BloomFilter this) { * is proportional to -log(p), but there is not much of a point after all, e.g. * optimalM(1000, 0.0000000000000001) = 76680 which is less than 10kb. Who cares! */ - long numBits = optimalNumOfBits(expectedInsertions, fpp); + @SuppressWarnings("value:assignment") // This warning might be a true postive. + @IntRange(from=0, to=2147483647) long numBits = optimalNumOfBits(expectedInsertions, fpp); int numHashFunctions = optimalNumOfHashFunctions(expectedInsertions, numBits); try { return new BloomFilter(new LockFreeBitArray(numBits), numHashFunctions, funnel, strategy); @@ -533,7 +534,7 @@ public int hashCode(@UnknownSignedness BloomFilter this) { * @param p false positive rate (must be 0 < p < 1) */ @VisibleForTesting - static @Positive long optimalNumOfBits(@Positive long n, @NonNegative double p) { + static @Positive long optimalNumOfBits(@Positive long n, double p) { if (p == 0) { p = Double.MIN_VALUE;//(2) }