The following issues were found
android/guava-testlib/src/com/google/common/collect/testing/google/MultimapReplaceValuesTester.java
43 issues
Line: 48
public class MultimapReplaceValuesTester<K, V>
extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
public void testReplaceValuesWithNullValue() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), null, v3());
multimap().replaceValues(k0(), values);
assertGet(k0(), values);
Reported by PMD.
Line: 50
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
public void testReplaceValuesWithNullValue() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), null, v3());
multimap().replaceValues(k0(), values);
assertGet(k0(), values);
}
Reported by PMD.
Line: 52
public void testReplaceValuesWithNullValue() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), null, v3());
multimap().replaceValues(k0(), values);
assertGet(k0(), values);
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
public void testReplaceValuesWithNullKey() {
Reported by PMD.
Line: 56
assertGet(k0(), values);
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
public void testReplaceValuesWithNullKey() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(null, values);
assertGet(null, values);
Reported by PMD.
Line: 60
public void testReplaceValuesWithNullKey() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(null, values);
assertGet(null, values);
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceEmptyValues() {
Reported by PMD.
Line: 64
assertGet(null, values);
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceEmptyValues() {
int size = multimap().size();
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
Reported by PMD.
Line: 65
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceEmptyValues() {
int size = multimap().size();
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
assertGet(k3(), values);
Reported by PMD.
Line: 66
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceEmptyValues() {
int size = multimap().size();
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
assertGet(k3(), values);
assertEquals(size + values.size(), multimap().size());
Reported by PMD.
Line: 69
int size = multimap().size();
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
assertGet(k3(), values);
assertEquals(size + values.size(), multimap().size());
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
Reported by PMD.
Line: 71
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
assertGet(k3(), values);
assertEquals(size + values.size(), multimap().size());
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceValuesWithEmpty() {
int size = multimap().size();
Reported by PMD.
android/guava-tests/test/com/google/common/collect/CompactHashMapTest.java
43 issues
Line: 39
* @author Louis Wasserman
*/
public class CompactHashMapTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
MapTestSuiteBuilder.using(
new TestStringMapGenerator() {
@Override
Reported by PMD.
Line: 66
return suite;
}
public void testTrimToSize() {
CompactHashMap<Integer, String> map = CompactHashMap.createWithExpectedSize(100);
for (int i = 0; i < 10; i++) {
map.put(i, Integer.toString(i));
}
map.trimToSize();
Reported by PMD.
Line: 66
return suite;
}
public void testTrimToSize() {
CompactHashMap<Integer, String> map = CompactHashMap.createWithExpectedSize(100);
for (int i = 0; i < 10; i++) {
map.put(i, Integer.toString(i));
}
map.trimToSize();
Reported by PMD.
Line: 71
for (int i = 0; i < 10; i++) {
map.put(i, Integer.toString(i));
}
map.trimToSize();
assertThat(map.entries).hasLength(10);
assertThat(map.keys).hasLength(10);
assertThat(map.values).hasLength(10);
assertEquals(10, map.size());
for (int i = 0; i < 10; i++) {
Reported by PMD.
Line: 72
map.put(i, Integer.toString(i));
}
map.trimToSize();
assertThat(map.entries).hasLength(10);
assertThat(map.keys).hasLength(10);
assertThat(map.values).hasLength(10);
assertEquals(10, map.size());
for (int i = 0; i < 10; i++) {
assertEquals(Integer.toString(i), map.get(i));
Reported by PMD.
Line: 73
}
map.trimToSize();
assertThat(map.entries).hasLength(10);
assertThat(map.keys).hasLength(10);
assertThat(map.values).hasLength(10);
assertEquals(10, map.size());
for (int i = 0; i < 10; i++) {
assertEquals(Integer.toString(i), map.get(i));
}
Reported by PMD.
Line: 74
map.trimToSize();
assertThat(map.entries).hasLength(10);
assertThat(map.keys).hasLength(10);
assertThat(map.values).hasLength(10);
assertEquals(10, map.size());
for (int i = 0; i < 10; i++) {
assertEquals(Integer.toString(i), map.get(i));
}
}
Reported by PMD.
Line: 75
assertThat(map.entries).hasLength(10);
assertThat(map.keys).hasLength(10);
assertThat(map.values).hasLength(10);
assertEquals(10, map.size());
for (int i = 0; i < 10; i++) {
assertEquals(Integer.toString(i), map.get(i));
}
}
Reported by PMD.
Line: 75
assertThat(map.entries).hasLength(10);
assertThat(map.keys).hasLength(10);
assertThat(map.values).hasLength(10);
assertEquals(10, map.size());
for (int i = 0; i < 10; i++) {
assertEquals(Integer.toString(i), map.get(i));
}
}
Reported by PMD.
Line: 77
assertThat(map.values).hasLength(10);
assertEquals(10, map.size());
for (int i = 0; i < 10; i++) {
assertEquals(Integer.toString(i), map.get(i));
}
}
public void testEntrySetValueAfterRemoved() {
CompactHashMap<Integer, String> map = CompactHashMap.create();
Reported by PMD.
android/guava-tests/test/com/google/common/hash/SipHashFunctionTest.java
43 issues
Line: 106
0x958a324ceb064572L
};
public void testVectors() {
for (int i = 0; i < EXPECTED.length; ++i) {
byte[] msg = new byte[i];
for (int j = 0; j < i; ++j) {
msg[j] = (byte) j;
}
Reported by PMD.
Line: 108
public void testVectors() {
for (int i = 0; i < EXPECTED.length; ++i) {
byte[] msg = new byte[i];
for (int j = 0; j < i; ++j) {
msg[j] = (byte) j;
}
assertSip(msg, EXPECTED[i]);
}
Reported by PMD.
Line: 118
// This test data comes from "SipHash: a fast short-input PRF", "Appendix A: Test values".
// It can be downloaded here: https://131002.net/siphash/siphash.pdf
public void test15ByteStringFromSipHashPaper() {
byte[] message =
new byte[] {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e
};
long k0 = 0x0706050403020100L;
Reported by PMD.
Line: 126
long k0 = 0x0706050403020100L;
long k1 = 0x0f0e0d0c0b0a0908L;
assertEquals(0xa129ca6149be45e5L, Hashing.sipHash24(k0, k1).hashBytes(message).asLong());
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
Reported by PMD.
Line: 126
long k0 = 0x0706050403020100L;
long k1 = 0x0f0e0d0c0b0a0908L;
assertEquals(0xa129ca6149be45e5L, Hashing.sipHash24(k0, k1).hashBytes(message).asLong());
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
Reported by PMD.
Line: 126
long k0 = 0x0706050403020100L;
long k1 = 0x0f0e0d0c0b0a0908L;
assertEquals(0xa129ca6149be45e5L, Hashing.sipHash24(k0, k1).hashBytes(message).asLong());
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
Reported by PMD.
Line: 130
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
assertSip(new byte[] {0x61}, 0x2ba3e8e9a71148caL);
assertSip(new byte[1000000], 0x28205108397aa742L);
assertSip("12345678", 0x02130609caea37ebL);
assertSip("abcdef", 0x2a6e77e733c7c05dL);
Reported by PMD.
Line: 130
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
assertSip(new byte[] {0x61}, 0x2ba3e8e9a71148caL);
assertSip(new byte[1000000], 0x28205108397aa742L);
assertSip("12345678", 0x02130609caea37ebL);
assertSip("abcdef", 0x2a6e77e733c7c05dL);
Reported by PMD.
Line: 148
// (2) 00 01 02 03 04 05 06 07 81
// (3) 00 01 02 03 04 05 06 07 ff (or anything in between)
// A fault implementation will generate collisions for these inputs.
public void testCollisionsDueToIncorrectSignExtension() {
byte[] col1 = new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, (byte) 0x80};
byte[] col2 = new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, (byte) 0x81};
byte[] col3 = new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, (byte) 0xff};
ImmutableSet<HashCode> hashCodes =
Reported by PMD.
Line: 158
SIP_WITH_KEY.hashBytes(col1),
SIP_WITH_KEY.hashBytes(col2),
SIP_WITH_KEY.hashBytes(col3));
assertEquals(3, hashCodes.size());
}
public void testToString() {
assertEquals("Hashing.sipHash24(" + K0 + ", " + K1 + ")", SIP_WITH_KEY.toString());
assertEquals("Hashing.sipHash24(" + K0 + ", " + K1 + ")", SIP_WITHOUT_KEY.toString());
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutTester.java
43 issues
Line: 47
@SuppressWarnings("unchecked") // too many "unchecked generic array creations"
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
Reported by PMD.
Line: 48
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
Reported by PMD.
Line: 49
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
public void setUp() throws Exception {
Reported by PMD.
Line: 50
public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
public void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 51
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
public void setUp() throws Exception {
super.setUp();
nullKeyEntry = entry(null, v3());
Reported by PMD.
Line: 53
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
public void setUp() throws Exception {
super.setUp();
nullKeyEntry = entry(null, v3());
nullValueEntry = entry(k3(), null);
nullKeyValueEntry = entry(null, null);
Reported by PMD.
Line: 62
presentKeyNullValueEntry = entry(k0(), null);
}
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPut_supportedPresent() {
assertEquals("put(present, value) should return the old value", v0(), getMap().put(k0(), v3()));
expectReplacement(entry(k0(), v3()));
}
Reported by PMD.
Line: 65
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPut_supportedPresent() {
assertEquals("put(present, value) should return the old value", v0(), getMap().put(k0(), v3()));
expectReplacement(entry(k0(), v3()));
}
@MapFeature.Require(SUPPORTS_PUT)
public void testPut_supportedNotPresent() {
Reported by PMD.
Line: 69
expectReplacement(entry(k0(), v3()));
}
@MapFeature.Require(SUPPORTS_PUT)
public void testPut_supportedNotPresent() {
assertNull("put(notPresent, value) should return null", put(e3()));
expectAdded(e3());
}
Reported by PMD.
Line: 75
expectAdded(e3());
}
@MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
@CollectionSize.Require(absent = ZERO)
public void testPutAbsentConcurrentWithEntrySetIteration() {
try {
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
put(e3());
Reported by PMD.
android/guava/src/com/google/common/collect/CompactHashSet.java
43 issues
Line: 76
*/
@GwtIncompatible // not worth using in GWT for now
@ElementTypesAreNonnullByDefault
class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implements Serializable {
// TODO(user): cache all field accesses in local vars
/** Creates an empty {@code CompactHashSet} instance. */
public static <E extends @Nullable Object> CompactHashSet<E> create() {
return new CompactHashSet<>();
Reported by PMD.
Line: 76
*/
@GwtIncompatible // not worth using in GWT for now
@ElementTypesAreNonnullByDefault
class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implements Serializable {
// TODO(user): cache all field accesses in local vars
/** Creates an empty {@code CompactHashSet} instance. */
public static <E extends @Nullable Object> CompactHashSet<E> create() {
return new CompactHashSet<>();
Reported by PMD.
Line: 76
*/
@GwtIncompatible // not worth using in GWT for now
@ElementTypesAreNonnullByDefault
class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implements Serializable {
// TODO(user): cache all field accesses in local vars
/** Creates an empty {@code CompactHashSet} instance. */
public static <E extends @Nullable Object> CompactHashSet<E> create() {
return new CompactHashSet<>();
Reported by PMD.
Line: 76
*/
@GwtIncompatible // not worth using in GWT for now
@ElementTypesAreNonnullByDefault
class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implements Serializable {
// TODO(user): cache all field accesses in local vars
/** Creates an empty {@code CompactHashSet} instance. */
public static <E extends @Nullable Object> CompactHashSet<E> create() {
return new CompactHashSet<>();
Reported by PMD.
Line: 94
public static <E extends @Nullable Object> CompactHashSet<E> create(
Collection<? extends E> collection) {
CompactHashSet<E> set = createWithExpectedSize(collection.size());
set.addAll(collection);
return set;
}
/**
* Creates a <i>mutable</i> {@code CompactHashSet} instance containing the given elements in
Reported by PMD.
Line: 197
private transient int metadata;
/** The number of elements contained in the set. */
private transient int size;
/** Constructs a new empty instance of {@code CompactHashSet}. */
CompactHashSet() {
init(CompactHashing.DEFAULT_SIZE);
}
Reported by PMD.
Line: 265
newDelegate.add(element(i));
}
this.table = newDelegate;
this.entries = null;
this.elements = null;
incrementModCount();
return newDelegate;
}
Reported by PMD.
Line: 266
}
this.table = newDelegate;
this.entries = null;
this.elements = null;
incrementModCount();
return newDelegate;
}
@VisibleForTesting
Reported by PMD.
Line: 294
@CanIgnoreReturnValue
@Override
public boolean add(@ParametricNullness E object) {
if (needsAllocArrays()) {
allocArrays();
}
Set<E> delegate = delegateOrNull();
if (delegate != null) {
Reported by PMD.
Line: 335
} while (next != UNSET);
if (bucketLength >= MAX_HASH_BUCKET_LENGTH) {
return convertToHashFloodingResistantImplementation().add(object);
}
if (newSize > mask) {
// Resize and add new entry
mask = resizeTable(mask, CompactHashing.newCapacity(mask), hash, newEntryIndex);
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/MultimapReplaceValuesTester.java
43 issues
Line: 48
public class MultimapReplaceValuesTester<K, V>
extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
public void testReplaceValuesWithNullValue() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), null, v3());
multimap().replaceValues(k0(), values);
assertGet(k0(), values);
Reported by PMD.
Line: 50
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
public void testReplaceValuesWithNullValue() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), null, v3());
multimap().replaceValues(k0(), values);
assertGet(k0(), values);
}
Reported by PMD.
Line: 52
public void testReplaceValuesWithNullValue() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), null, v3());
multimap().replaceValues(k0(), values);
assertGet(k0(), values);
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
public void testReplaceValuesWithNullKey() {
Reported by PMD.
Line: 56
assertGet(k0(), values);
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
public void testReplaceValuesWithNullKey() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(null, values);
assertGet(null, values);
Reported by PMD.
Line: 60
public void testReplaceValuesWithNullKey() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(null, values);
assertGet(null, values);
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceEmptyValues() {
Reported by PMD.
Line: 64
assertGet(null, values);
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceEmptyValues() {
int size = multimap().size();
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
Reported by PMD.
Line: 65
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceEmptyValues() {
int size = multimap().size();
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
assertGet(k3(), values);
Reported by PMD.
Line: 66
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceEmptyValues() {
int size = multimap().size();
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
assertGet(k3(), values);
assertEquals(size + values.size(), multimap().size());
Reported by PMD.
Line: 69
int size = multimap().size();
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
assertGet(k3(), values);
assertEquals(size + values.size(), multimap().size());
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
Reported by PMD.
Line: 71
List<V> values = Arrays.asList(v0(), v2(), v3());
multimap().replaceValues(k3(), values);
assertGet(k3(), values);
assertEquals(size + values.size(), multimap().size());
}
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceValuesWithEmpty() {
int size = multimap().size();
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/MoreExecutors.java
43 issues
Line: 806
* don't *seem* to mind, but there might be edge cases of which we're unaware.)
*/
} catch (IllegalAccessException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (NoSuchMethodException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (InvocationTargetException e) {
Reported by PMD.
Line: 808
} catch (IllegalAccessException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (NoSuchMethodException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (InvocationTargetException e) {
throw Throwables.propagate(e.getCause());
}
Reported by PMD.
Line: 810
} catch (ClassNotFoundException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (NoSuchMethodException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (InvocationTargetException e) {
throw Throwables.propagate(e.getCause());
}
}
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.util.concurrent;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.Beta;
Reported by PMD.
Line: 65
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class MoreExecutors {
private MoreExecutors() {}
/**
* Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application
* is complete. It does so by using daemon threads and adding a shutdown hook to wait for their
Reported by PMD.
Line: 65
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class MoreExecutors {
private MoreExecutors() {}
/**
* Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application
* is complete. It does so by using daemon threads and adding a shutdown hook to wait for their
Reported by PMD.
Line: 65
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class MoreExecutors {
private MoreExecutors() {}
/**
* Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application
* is complete. It does so by using daemon threads and adding a shutdown hook to wait for their
Reported by PMD.
Line: 65
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class MoreExecutors {
private MoreExecutors() {}
/**
* Converts the given ThreadPoolExecutor into an ExecutorService that exits when the application
* is complete. It does so by using daemon threads and adding a shutdown hook to wait for their
Reported by PMD.
Line: 83
*/
@Beta
@GwtIncompatible // TODO
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
public static ExecutorService getExitingExecutorService(
ThreadPoolExecutor executor, long terminationTimeout, TimeUnit timeUnit) {
return new Application().getExitingExecutorService(executor, terminationTimeout, timeUnit);
}
Reported by PMD.
Line: 226
@VisibleForTesting
void addShutdownHook(Thread hook) {
Runtime.getRuntime().addShutdownHook(hook);
}
}
@GwtIncompatible // TODO
private static void useDaemonThreadFactory(ThreadPoolExecutor executor) {
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/CollectionRetainAllTester.java
43 issues
Line: 44
@SuppressWarnings("unchecked") // too many "unchecked generic array creations"
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionRetainAllTester<E> extends AbstractCollectionTester<E> {
/** A collection of elements to retain, along with a description for use in failure messages. */
private class Target {
private final Collection<E> toRetain;
private final String description;
Reported by PMD.
Line: 48
/** A collection of elements to retain, along with a description for use in failure messages. */
private class Target {
private final Collection<E> toRetain;
private final String description;
private Target(Collection<E> toRetain, String description) {
this.toRetain = toRetain;
this.description = description;
Reported by PMD.
Line: 49
/** A collection of elements to retain, along with a description for use in failure messages. */
private class Target {
private final Collection<E> toRetain;
private final String description;
private Target(Collection<E> toRetain, String description) {
this.toRetain = toRetain;
this.description = description;
}
Reported by PMD.
Line: 62
}
}
private Target empty;
private Target disjoint;
private Target superset;
private Target nonEmptyProperSubset;
private Target sameElements;
private Target partialOverlap;
Reported by PMD.
Line: 63
}
private Target empty;
private Target disjoint;
private Target superset;
private Target nonEmptyProperSubset;
private Target sameElements;
private Target partialOverlap;
private Target containsDuplicates;
Reported by PMD.
Line: 64
private Target empty;
private Target disjoint;
private Target superset;
private Target nonEmptyProperSubset;
private Target sameElements;
private Target partialOverlap;
private Target containsDuplicates;
private Target nullSingleton;
Reported by PMD.
Line: 65
private Target empty;
private Target disjoint;
private Target superset;
private Target nonEmptyProperSubset;
private Target sameElements;
private Target partialOverlap;
private Target containsDuplicates;
private Target nullSingleton;
Reported by PMD.
Line: 66
private Target disjoint;
private Target superset;
private Target nonEmptyProperSubset;
private Target sameElements;
private Target partialOverlap;
private Target containsDuplicates;
private Target nullSingleton;
@Override
Reported by PMD.
Line: 67
private Target superset;
private Target nonEmptyProperSubset;
private Target sameElements;
private Target partialOverlap;
private Target containsDuplicates;
private Target nullSingleton;
@Override
public void setUp() throws Exception {
Reported by PMD.
Line: 68
private Target nonEmptyProperSubset;
private Target sameElements;
private Target partialOverlap;
private Target containsDuplicates;
private Target nullSingleton;
@Override
public void setUp() throws Exception {
super.setUp();
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/MapPutTester.java
43 issues
Line: 47
@SuppressWarnings("unchecked") // too many "unchecked generic array creations"
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
Reported by PMD.
Line: 48
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
Reported by PMD.
Line: 49
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
public void setUp() throws Exception {
Reported by PMD.
Line: 50
public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
public void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 51
private Entry<K, V> nullKeyEntry;
private Entry<K, V> nullValueEntry;
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
public void setUp() throws Exception {
super.setUp();
nullKeyEntry = entry(null, v3());
Reported by PMD.
Line: 53
private Entry<K, V> nullKeyValueEntry;
private Entry<K, V> presentKeyNullValueEntry;
@Override
public void setUp() throws Exception {
super.setUp();
nullKeyEntry = entry(null, v3());
nullValueEntry = entry(k3(), null);
nullKeyValueEntry = entry(null, null);
Reported by PMD.
Line: 62
presentKeyNullValueEntry = entry(k0(), null);
}
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPut_supportedPresent() {
assertEquals("put(present, value) should return the old value", v0(), getMap().put(k0(), v3()));
expectReplacement(entry(k0(), v3()));
}
Reported by PMD.
Line: 65
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPut_supportedPresent() {
assertEquals("put(present, value) should return the old value", v0(), getMap().put(k0(), v3()));
expectReplacement(entry(k0(), v3()));
}
@MapFeature.Require(SUPPORTS_PUT)
public void testPut_supportedNotPresent() {
Reported by PMD.
Line: 69
expectReplacement(entry(k0(), v3()));
}
@MapFeature.Require(SUPPORTS_PUT)
public void testPut_supportedNotPresent() {
assertNull("put(notPresent, value) should return null", put(e3()));
expectAdded(e3());
}
Reported by PMD.
Line: 75
expectAdded(e3());
}
@MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
@CollectionSize.Require(absent = ZERO)
public void testPutAbsentConcurrentWithEntrySetIteration() {
try {
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
put(e3());
Reported by PMD.
guava-tests/test/com/google/common/hash/SipHashFunctionTest.java
43 issues
Line: 106
0x958a324ceb064572L
};
public void testVectors() {
for (int i = 0; i < EXPECTED.length; ++i) {
byte[] msg = new byte[i];
for (int j = 0; j < i; ++j) {
msg[j] = (byte) j;
}
Reported by PMD.
Line: 108
public void testVectors() {
for (int i = 0; i < EXPECTED.length; ++i) {
byte[] msg = new byte[i];
for (int j = 0; j < i; ++j) {
msg[j] = (byte) j;
}
assertSip(msg, EXPECTED[i]);
}
Reported by PMD.
Line: 118
// This test data comes from "SipHash: a fast short-input PRF", "Appendix A: Test values".
// It can be downloaded here: https://131002.net/siphash/siphash.pdf
public void test15ByteStringFromSipHashPaper() {
byte[] message =
new byte[] {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e
};
long k0 = 0x0706050403020100L;
Reported by PMD.
Line: 126
long k0 = 0x0706050403020100L;
long k1 = 0x0f0e0d0c0b0a0908L;
assertEquals(0xa129ca6149be45e5L, Hashing.sipHash24(k0, k1).hashBytes(message).asLong());
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
Reported by PMD.
Line: 126
long k0 = 0x0706050403020100L;
long k1 = 0x0f0e0d0c0b0a0908L;
assertEquals(0xa129ca6149be45e5L, Hashing.sipHash24(k0, k1).hashBytes(message).asLong());
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
Reported by PMD.
Line: 126
long k0 = 0x0706050403020100L;
long k1 = 0x0f0e0d0c0b0a0908L;
assertEquals(0xa129ca6149be45e5L, Hashing.sipHash24(k0, k1).hashBytes(message).asLong());
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
Reported by PMD.
Line: 130
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
assertSip(new byte[] {0x61}, 0x2ba3e8e9a71148caL);
assertSip(new byte[1000000], 0x28205108397aa742L);
assertSip("12345678", 0x02130609caea37ebL);
assertSip("abcdef", 0x2a6e77e733c7c05dL);
Reported by PMD.
Line: 130
}
// From https://github.com/BrandonHaynes/siphash-csharp/blob/master/tests/Tests.cs
public void testKnownValues() {
assertSip(new byte[] {}, 0x726fdb47dd0e0e31L);
assertSip(new byte[] {0x61}, 0x2ba3e8e9a71148caL);
assertSip(new byte[1000000], 0x28205108397aa742L);
assertSip("12345678", 0x02130609caea37ebL);
assertSip("abcdef", 0x2a6e77e733c7c05dL);
Reported by PMD.
Line: 148
// (2) 00 01 02 03 04 05 06 07 81
// (3) 00 01 02 03 04 05 06 07 ff (or anything in between)
// A fault implementation will generate collisions for these inputs.
public void testCollisionsDueToIncorrectSignExtension() {
byte[] col1 = new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, (byte) 0x80};
byte[] col2 = new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, (byte) 0x81};
byte[] col3 = new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, (byte) 0xff};
ImmutableSet<HashCode> hashCodes =
Reported by PMD.
Line: 158
SIP_WITH_KEY.hashBytes(col1),
SIP_WITH_KEY.hashBytes(col2),
SIP_WITH_KEY.hashBytes(col3));
assertEquals(3, hashCodes.size());
}
public void testToString() {
assertEquals("Hashing.sipHash24(" + K0 + ", " + K1 + ")", SIP_WITH_KEY.toString());
assertEquals("Hashing.sipHash24(" + K0 + ", " + K1 + ")", SIP_WITHOUT_KEY.toString());
Reported by PMD.