The following issues were found
android/guava-testlib/src/com/google/common/collect/testing/google/MultimapValuesTester.java
8 issues
Line: 41
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapValuesTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
public void testValues() {
List<V> expected = Lists.newArrayList();
for (Entry<K, V> entry : getSampleElements()) {
expected.add(entry.getValue());
}
assertEqualIgnoringOrder(expected, multimap().values());
Reported by PMD.
Line: 46
for (Entry<K, V> entry : getSampleElements()) {
expected.add(entry.getValue());
}
assertEqualIgnoringOrder(expected, multimap().values());
}
@CollectionFeature.Require(KNOWN_ORDER)
public void testValuesInOrder() {
List<V> expected = Lists.newArrayList();
Reported by PMD.
Line: 49
assertEqualIgnoringOrder(expected, multimap().values());
}
@CollectionFeature.Require(KNOWN_ORDER)
public void testValuesInOrder() {
List<V> expected = Lists.newArrayList();
for (Entry<K, V> entry : getOrderedElements()) {
expected.add(entry.getValue());
}
Reported by PMD.
Line: 55
for (Entry<K, V> entry : getOrderedElements()) {
expected.add(entry.getValue());
}
assertEqualInOrder(expected, multimap().values());
}
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
@CollectionSize.Require(ONE)
public void testValuesIteratorRemove() {
Reported by PMD.
Line: 58
assertEqualInOrder(expected, multimap().values());
}
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
@CollectionSize.Require(ONE)
public void testValuesIteratorRemove() {
Iterator<V> valuesItr = multimap().values().iterator();
valuesItr.next();
valuesItr.remove();
Reported by PMD.
Line: 61
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
@CollectionSize.Require(ONE)
public void testValuesIteratorRemove() {
Iterator<V> valuesItr = multimap().values().iterator();
valuesItr.next();
valuesItr.remove();
assertTrue(multimap().isEmpty());
}
}
Reported by PMD.
Line: 61
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
@CollectionSize.Require(ONE)
public void testValuesIteratorRemove() {
Iterator<V> valuesItr = multimap().values().iterator();
valuesItr.next();
valuesItr.remove();
assertTrue(multimap().isEmpty());
}
}
Reported by PMD.
Line: 64
Iterator<V> valuesItr = multimap().values().iterator();
valuesItr.next();
valuesItr.remove();
assertTrue(multimap().isEmpty());
}
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/testers/QueueOfferTester.java
8 issues
Line: 36
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class QueueOfferTester<E> extends AbstractQueueTester<E> {
@CollectionFeature.Require(SUPPORTS_ADD)
public void testOffer_supportedNotPresent() {
assertTrue("offer(notPresent) should return true", getQueue().offer(e3()));
expectAdded(e3());
}
Reported by PMD.
Line: 38
public class QueueOfferTester<E> extends AbstractQueueTester<E> {
@CollectionFeature.Require(SUPPORTS_ADD)
public void testOffer_supportedNotPresent() {
assertTrue("offer(notPresent) should return true", getQueue().offer(e3()));
expectAdded(e3());
}
@CollectionFeature.Require({SUPPORTS_ADD, ALLOWS_NULL_VALUES})
public void testOffer_nullSupported() {
Reported by PMD.
Line: 42
expectAdded(e3());
}
@CollectionFeature.Require({SUPPORTS_ADD, ALLOWS_NULL_VALUES})
public void testOffer_nullSupported() {
assertTrue("offer(null) should return true", getQueue().offer(null));
expectAdded((E) null);
}
Reported by PMD.
Line: 44
@CollectionFeature.Require({SUPPORTS_ADD, ALLOWS_NULL_VALUES})
public void testOffer_nullSupported() {
assertTrue("offer(null) should return true", getQueue().offer(null));
expectAdded((E) null);
}
@CollectionFeature.Require(value = SUPPORTS_ADD, absent = ALLOWS_NULL_VALUES)
public void testOffer_nullUnsupported() {
Reported by PMD.
Line: 48
expectAdded((E) null);
}
@CollectionFeature.Require(value = SUPPORTS_ADD, absent = ALLOWS_NULL_VALUES)
public void testOffer_nullUnsupported() {
try {
getQueue().offer(null);
fail("offer(null) should throw");
} catch (NullPointerException expected) {
Reported by PMD.
Line: 51
@CollectionFeature.Require(value = SUPPORTS_ADD, absent = ALLOWS_NULL_VALUES)
public void testOffer_nullUnsupported() {
try {
getQueue().offer(null);
fail("offer(null) should throw");
} catch (NullPointerException expected) {
}
expectUnchanged();
expectNullMissingWhenNullUnsupported("Should not contain null after unsupported offer(null)");
Reported by PMD.
Line: 53
try {
getQueue().offer(null);
fail("offer(null) should throw");
} catch (NullPointerException expected) {
}
expectUnchanged();
expectNullMissingWhenNullUnsupported("Should not contain null after unsupported offer(null)");
}
}
Reported by PMD.
Line: 53
try {
getQueue().offer(null);
fail("offer(null) should throw");
} catch (NullPointerException expected) {
}
expectUnchanged();
expectNullMissingWhenNullUnsupported("Should not contain null after unsupported offer(null)");
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ForwardingNavigableSetTest.java
8 issues
Line: 44
* @author Louis Wasserman
*/
public class ForwardingNavigableSetTest extends TestCase {
static class StandardImplForwardingNavigableSet<T> extends ForwardingNavigableSet<T> {
private final NavigableSet<T> backingSet;
StandardImplForwardingNavigableSet(NavigableSet<T> backingSet) {
this.backingSet = backingSet;
}
Reported by PMD.
Line: 45
*/
public class ForwardingNavigableSetTest extends TestCase {
static class StandardImplForwardingNavigableSet<T> extends ForwardingNavigableSet<T> {
private final NavigableSet<T> backingSet;
StandardImplForwardingNavigableSet(NavigableSet<T> backingSet) {
this.backingSet = backingSet;
}
Reported by PMD.
Line: 162
}
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ForwardingNavigableSetTest.class);
suite.addTest(
SetTestSuiteBuilder.using(
Reported by PMD.
Line: 191
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
SafeTreeSet<String> set = new SafeTreeSet<>(Ordering.natural().nullsFirst());
Collections.addAll(set, elements);
return new StandardImplForwardingNavigableSet<>(set);
}
@Override
Reported by PMD.
Line: 214
return suite;
}
@SuppressWarnings({"rawtypes", "unchecked"})
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
NavigableSet.class,
new Function<NavigableSet, NavigableSet>() {
Reported by PMD.
Line: 215
}
@SuppressWarnings({"rawtypes", "unchecked"})
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
NavigableSet.class,
new Function<NavigableSet, NavigableSet>() {
@Override
Reported by PMD.
Line: 227
});
}
public void testEquals() {
NavigableSet<String> set1 = ImmutableSortedSet.of("one");
NavigableSet<String> set2 = ImmutableSortedSet.of("two");
new EqualsTester()
.addEqualityGroup(set1, wrap(set1), wrap(set1))
.addEqualityGroup(set2, wrap(set2))
Reported by PMD.
Line: 227
});
}
public void testEquals() {
NavigableSet<String> set1 = ImmutableSortedSet.of("one");
NavigableSet<String> set2 = ImmutableSortedSet.of("two");
new EqualsTester()
.addEqualityGroup(set1, wrap(set1), wrap(set1))
.addEqualityGroup(set2, wrap(set2))
Reported by PMD.
android/guava-testlib/test/com/google/common/collect/testing/SafeTreeMapTest.java
8 issues
Line: 45
* @author Louis Wasserman
*/
public class SafeTreeMapTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(SafeTreeMapTest.class);
suite.addTest(
NavigableMapTestSuiteBuilder.using(
new TestStringSortedMapGenerator() {
Reported by PMD.
Line: 104
return suite;
}
@GwtIncompatible // SerializableTester
public void testViewSerialization() {
Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3);
SerializableTester.reserializeAndAssert(map.entrySet());
SerializableTester.reserializeAndAssert(map.keySet());
assertEquals(
Reported by PMD.
Line: 107
@GwtIncompatible // SerializableTester
public void testViewSerialization() {
Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3);
SerializableTester.reserializeAndAssert(map.entrySet());
SerializableTester.reserializeAndAssert(map.keySet());
assertEquals(
Lists.newArrayList(map.values()),
Lists.newArrayList(SerializableTester.reserialize(map.values())));
}
Reported by PMD.
Line: 108
public void testViewSerialization() {
Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3);
SerializableTester.reserializeAndAssert(map.entrySet());
SerializableTester.reserializeAndAssert(map.keySet());
assertEquals(
Lists.newArrayList(map.values()),
Lists.newArrayList(SerializableTester.reserialize(map.values())));
}
Reported by PMD.
Line: 109
Map<String, Integer> map = ImmutableSortedMap.of("one", 1, "two", 2, "three", 3);
SerializableTester.reserializeAndAssert(map.entrySet());
SerializableTester.reserializeAndAssert(map.keySet());
assertEquals(
Lists.newArrayList(map.values()),
Lists.newArrayList(SerializableTester.reserialize(map.values())));
}
@GwtIncompatible // SerializableTester
Reported by PMD.
Line: 110
SerializableTester.reserializeAndAssert(map.entrySet());
SerializableTester.reserializeAndAssert(map.keySet());
assertEquals(
Lists.newArrayList(map.values()),
Lists.newArrayList(SerializableTester.reserialize(map.values())));
}
@GwtIncompatible // SerializableTester
public static class ReserializedMapTests extends SortedMapInterfaceTest<String, Integer> {
Reported by PMD.
Line: 111
SerializableTester.reserializeAndAssert(map.keySet());
assertEquals(
Lists.newArrayList(map.values()),
Lists.newArrayList(SerializableTester.reserialize(map.values())));
}
@GwtIncompatible // SerializableTester
public static class ReserializedMapTests extends SortedMapInterfaceTest<String, Integer> {
public ReserializedMapTests() {
Reported by PMD.
Line: 130
}
@Override
protected SortedMap<String, Integer> makeEmptyMap() throws UnsupportedOperationException {
NavigableMap<String, Integer> map = new SafeTreeMap<>();
return SerializableTester.reserialize(map);
}
@Override
Reported by PMD.
android/guava-tests/benchmark/com/google/common/cache/SegmentBenchmark.java
8 issues
Line: 35
public class SegmentBenchmark {
@Param({"16", "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192"})
int capacity;
private Segment<Object, Object> segment;
@BeforeExperiment
void setUp() {
Reported by PMD.
Line: 37
@Param({"16", "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192"})
int capacity;
private Segment<Object, Object> segment;
@BeforeExperiment
void setUp() {
LocalCache<Object, Object> cache =
new LocalCache<>(
Reported by PMD.
Line: 39
private Segment<Object, Object> segment;
@BeforeExperiment
void setUp() {
LocalCache<Object, Object> cache =
new LocalCache<>(
CacheBuilder.newBuilder().concurrencyLevel(1).initialCapacity(capacity), null);
checkState(cache.segments.length == 1);
Reported by PMD.
Line: 46
CacheBuilder.newBuilder().concurrencyLevel(1).initialCapacity(capacity), null);
checkState(cache.segments.length == 1);
segment = cache.segments[0];
checkState(segment.table.length() == capacity);
for (int i = 0; i < segment.threshold; i++) {
cache.put(new Object(), new Object());
}
checkState(segment.table.length() == capacity);
}
Reported by PMD.
Line: 48
segment = cache.segments[0];
checkState(segment.table.length() == capacity);
for (int i = 0; i < segment.threshold; i++) {
cache.put(new Object(), new Object());
}
checkState(segment.table.length() == capacity);
}
@SuppressWarnings("GuardedBy")
Reported by PMD.
Line: 48
segment = cache.segments[0];
checkState(segment.table.length() == capacity);
for (int i = 0; i < segment.threshold; i++) {
cache.put(new Object(), new Object());
}
checkState(segment.table.length() == capacity);
}
@SuppressWarnings("GuardedBy")
Reported by PMD.
Line: 50
for (int i = 0; i < segment.threshold; i++) {
cache.put(new Object(), new Object());
}
checkState(segment.table.length() == capacity);
}
@SuppressWarnings("GuardedBy")
@Benchmark
int time(int reps) {
Reported by PMD.
Line: 57
@Benchmark
int time(int reps) {
int dummy = 0;
AtomicReferenceArray<ReferenceEntry<Object, Object>> oldTable = segment.table;
for (int i = 0; i < reps; i++) {
// TODO(b/145386688): This access should be guarded by 'this.segment', which is not currently
// held
segment.expand();
segment.table = oldTable;
Reported by PMD.
android/guava-tests/benchmark/com/google/common/collect/ComparatorDelegationOverheadBenchmark.java
8 issues
Line: 32
* @author Louis Wasserman
*/
public class ComparatorDelegationOverheadBenchmark {
private final Integer[][] inputArrays = new Integer[0x100][];
@Param({"10000"})
int n;
@BeforeExperiment
Reported by PMD.
Line: 35
private final Integer[][] inputArrays = new Integer[0x100][];
@Param({"10000"})
int n;
@BeforeExperiment
void setUp() throws Exception {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
Reported by PMD.
Line: 37
@Param({"10000"})
int n;
@BeforeExperiment
void setUp() throws Exception {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
Integer[] array = new Integer[n];
for (int j = 0; j < n; j++) {
Reported by PMD.
Line: 38
int n;
@BeforeExperiment
void setUp() throws Exception {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
Integer[] array = new Integer[n];
for (int j = 0; j < n; j++) {
array[j] = rng.nextInt();
Reported by PMD.
Line: 41
void setUp() throws Exception {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
Integer[] array = new Integer[n];
for (int j = 0; j < n; j++) {
array[j] = rng.nextInt();
}
inputArrays[i] = array;
}
Reported by PMD.
Line: 39
@BeforeExperiment
void setUp() throws Exception {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
Integer[] array = new Integer[n];
for (int j = 0; j < n; j++) {
array[j] = rng.nextInt();
}
Reported by PMD.
Line: 41
void setUp() throws Exception {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
Integer[] array = new Integer[n];
for (int j = 0; j < n; j++) {
array[j] = rng.nextInt();
}
inputArrays[i] = array;
}
Reported by PMD.
Line: 43
for (int i = 0; i < 0x100; i++) {
Integer[] array = new Integer[n];
for (int j = 0; j < n; j++) {
array[j] = rng.nextInt();
}
inputArrays[i] = array;
}
}
Reported by PMD.
android/guava-tests/benchmark/com/google/common/collect/MapsMemoryBenchmark.java
8 issues
Line: 60
"HashBiMapImpl",
"ImmutableBiMapImpl"
})
String implName;
MapsImplEnum mapsImpl;
/**
* A map of contents pre-created before experiment starts to only measure map creation cost. The
Reported by PMD.
Line: 62
})
String implName;
MapsImplEnum mapsImpl;
/**
* A map of contents pre-created before experiment starts to only measure map creation cost. The
* implementation for the creation of contents is independent and could be different from that of
* the map under test.
Reported by PMD.
Line: 69
* implementation for the creation of contents is independent and could be different from that of
* the map under test.
*/
Map<Element, Element> contents;
/** Map pre-created before experiment starts to only measure iteration cost during experiment. */
Map<Element, Element> map;
CollectionBenchmarkSampleData elems;
Reported by PMD.
Line: 72
Map<Element, Element> contents;
/** Map pre-created before experiment starts to only measure iteration cost during experiment. */
Map<Element, Element> map;
CollectionBenchmarkSampleData elems;
@Param({"0", "1", "100", "10000"})
int elements;
Reported by PMD.
Line: 74
/** Map pre-created before experiment starts to only measure iteration cost during experiment. */
Map<Element, Element> map;
CollectionBenchmarkSampleData elems;
@Param({"0", "1", "100", "10000"})
int elements;
@BeforeExperiment
Reported by PMD.
Line: 77
CollectionBenchmarkSampleData elems;
@Param({"0", "1", "100", "10000"})
int elements;
@BeforeExperiment
public void prepareContents() throws Exception {
mapsImpl = mapEnums.get(implName);
elems = new CollectionBenchmarkSampleData(elements);
Reported by PMD.
Line: 80
int elements;
@BeforeExperiment
public void prepareContents() throws Exception {
mapsImpl = mapEnums.get(implName);
elems = new CollectionBenchmarkSampleData(elements);
contents = Maps.newHashMap();
for (Element key : elems.getValuesInSet()) {
contents.put(key, key);
Reported by PMD.
Line: 92
@Benchmark
@Footprint(exclude = Element.class)
public Map<Element, Element> create() throws Exception {
return mapsImpl.create(contents);
}
@Benchmark
public int iterate() {
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionClearTester.java
7 issues
Line: 41
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionClearTester<E> extends AbstractCollectionTester<E> {
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testClear() {
collection.clear();
assertTrue("After clear(), a collection should be empty.", collection.isEmpty());
assertEquals(0, collection.size());
assertFalse(collection.iterator().hasNext());
Reported by PMD.
Line: 42
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionClearTester<E> extends AbstractCollectionTester<E> {
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testClear() {
collection.clear();
assertTrue("After clear(), a collection should be empty.", collection.isEmpty());
assertEquals(0, collection.size());
assertFalse(collection.iterator().hasNext());
}
Reported by PMD.
Line: 46
collection.clear();
assertTrue("After clear(), a collection should be empty.", collection.isEmpty());
assertEquals(0, collection.size());
assertFalse(collection.iterator().hasNext());
}
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testClear_unsupported() {
Reported by PMD.
Line: 49
assertFalse(collection.iterator().hasNext());
}
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testClear_unsupported() {
try {
collection.clear();
fail(
Reported by PMD.
Line: 62
expectUnchanged();
}
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
@CollectionSize.Require(ZERO)
public void testClear_unsupportedByEmptyCollection() {
try {
collection.clear();
} catch (UnsupportedOperationException tolerated) {
Reported by PMD.
Line: 67
public void testClear_unsupportedByEmptyCollection() {
try {
collection.clear();
} catch (UnsupportedOperationException tolerated) {
}
expectUnchanged();
}
@CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
Reported by PMD.
Line: 72
expectUnchanged();
}
@CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
@CollectionSize.Require(SEVERAL)
public void testClearConcurrentWithIteration() {
try {
Iterator<E> iterator = collection.iterator();
collection.clear();
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ForwardingSetTest.java
7 issues
Line: 42
* @author Louis Wasserman
*/
public class ForwardingSetTest extends TestCase {
static class StandardImplForwardingSet<T> extends ForwardingSet<T> {
private final Set<T> backingSet;
StandardImplForwardingSet(Set<T> backingSet) {
this.backingSet = backingSet;
}
Reported by PMD.
Line: 43
*/
public class ForwardingSetTest extends TestCase {
static class StandardImplForwardingSet<T> extends ForwardingSet<T> {
private final Set<T> backingSet;
StandardImplForwardingSet(Set<T> backingSet) {
this.backingSet = backingSet;
}
Reported by PMD.
Line: 115
}
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ForwardingSetTest.class);
suite.addTest(
SetTestSuiteBuilder.using(
Reported by PMD.
Line: 148
return suite;
}
@SuppressWarnings({"rawtypes", "unchecked"})
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
Set.class,
new Function<Set, Set>() {
Reported by PMD.
Line: 149
}
@SuppressWarnings({"rawtypes", "unchecked"})
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
Set.class,
new Function<Set, Set>() {
@Override
Reported by PMD.
Line: 161
});
}
public void testEquals() {
Set<String> set1 = ImmutableSet.of("one");
Set<String> set2 = ImmutableSet.of("two");
new EqualsTester()
.addEqualityGroup(set1, wrap(set1), wrap(set1))
.addEqualityGroup(set2, wrap(set2))
Reported by PMD.
Line: 161
});
}
public void testEquals() {
Set<String> set1 = ImmutableSet.of("one");
Set<String> set2 = ImmutableSet.of("two");
new EqualsTester()
.addEqualityGroup(set1, wrap(set1), wrap(set1))
.addEqualityGroup(set2, wrap(set2))
Reported by PMD.
android/guava-tests/benchmark/com/google/common/math/IntMathBenchmark.java
7 issues
Line: 36
*/
public class IntMathBenchmark {
private static int[] exponent = new int[ARRAY_SIZE];
private static int[] factorial = new int[ARRAY_SIZE];
private static int[] binomial = new int[ARRAY_SIZE];
private static final int[] positive = new int[ARRAY_SIZE];
private static final int[] nonnegative = new int[ARRAY_SIZE];
private static final int[] ints = new int[ARRAY_SIZE];
Reported by PMD.
Line: 37
public class IntMathBenchmark {
private static int[] exponent = new int[ARRAY_SIZE];
private static int[] factorial = new int[ARRAY_SIZE];
private static int[] binomial = new int[ARRAY_SIZE];
private static final int[] positive = new int[ARRAY_SIZE];
private static final int[] nonnegative = new int[ARRAY_SIZE];
private static final int[] ints = new int[ARRAY_SIZE];
@BeforeExperiment
Reported by PMD.
Line: 42
private static final int[] nonnegative = new int[ARRAY_SIZE];
private static final int[] ints = new int[ARRAY_SIZE];
@BeforeExperiment
void setUp() {
for (int i = 0; i < ARRAY_SIZE; i++) {
exponent[i] = randomExponent();
factorial[i] = RANDOM_SOURCE.nextInt(50);
binomial[i] = RANDOM_SOURCE.nextInt(factorial[i] + 1);
Reported by PMD.
Line: 48
exponent[i] = randomExponent();
factorial[i] = RANDOM_SOURCE.nextInt(50);
binomial[i] = RANDOM_SOURCE.nextInt(factorial[i] + 1);
positive[i] = randomPositiveBigInteger(Integer.SIZE - 1).intValue();
nonnegative[i] = randomNonNegativeBigInteger(Integer.SIZE - 1).intValue();
ints[i] = RANDOM_SOURCE.nextInt();
}
}
Reported by PMD.
Line: 49
factorial[i] = RANDOM_SOURCE.nextInt(50);
binomial[i] = RANDOM_SOURCE.nextInt(factorial[i] + 1);
positive[i] = randomPositiveBigInteger(Integer.SIZE - 1).intValue();
nonnegative[i] = randomNonNegativeBigInteger(Integer.SIZE - 1).intValue();
ints[i] = RANDOM_SOURCE.nextInt();
}
}
@Benchmark
Reported by PMD.
Line: 106
@Benchmark
int isPrime(int reps) {
int tmp = 0;
for (int i = 0; i < reps; i++) {
int j = i & ARRAY_MASK;
if (IntMath.isPrime(positive[j])) {
tmp++;
}
Reported by PMD.
Line: 110
for (int i = 0; i < reps; i++) {
int j = i & ARRAY_MASK;
if (IntMath.isPrime(positive[j])) {
tmp++;
}
}
return tmp;
}
}
Reported by PMD.