The following issues were found
guava/src/com/google/common/hash/BloomFilterStrategies.java
29 issues
Line: 55
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
long hash64 = Hashing.murmur3_128().hashObject(object, funnel).asLong();
int hash1 = (int) hash64;
int hash2 = (int) (hash64 >>> 32);
boolean bitsChanged = false;
for (int i = 1; i <= numHashFunctions; i++) {
Reported by PMD.
Line: 55
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
long hash64 = Hashing.murmur3_128().hashObject(object, funnel).asLong();
int hash1 = (int) hash64;
int hash2 = (int) (hash64 >>> 32);
boolean bitsChanged = false;
for (int i = 1; i <= numHashFunctions; i++) {
Reported by PMD.
Line: 78
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
long hash64 = Hashing.murmur3_128().hashObject(object, funnel).asLong();
int hash1 = (int) hash64;
int hash2 = (int) (hash64 >>> 32);
for (int i = 1; i <= numHashFunctions; i++) {
int combinedHash = hash1 + (i * hash2);
Reported by PMD.
Line: 78
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
long hash64 = Hashing.murmur3_128().hashObject(object, funnel).asLong();
int hash1 = (int) hash64;
int hash2 = (int) (hash64 >>> 32);
for (int i = 1; i <= numHashFunctions; i++) {
int combinedHash = hash1 + (i * hash2);
Reported by PMD.
Line: 109
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
byte[] bytes = Hashing.murmur3_128().hashObject(object, funnel).getBytesInternal();
long hash1 = lowerEight(bytes);
long hash2 = upperEight(bytes);
boolean bitsChanged = false;
long combinedHash = hash1;
Reported by PMD.
Line: 109
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
byte[] bytes = Hashing.murmur3_128().hashObject(object, funnel).getBytesInternal();
long hash1 = lowerEight(bytes);
long hash2 = upperEight(bytes);
boolean bitsChanged = false;
long combinedHash = hash1;
Reported by PMD.
Line: 130
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
byte[] bytes = Hashing.murmur3_128().hashObject(object, funnel).getBytesInternal();
long hash1 = lowerEight(bytes);
long hash2 = upperEight(bytes);
long combinedHash = hash1;
for (int i = 0; i < numHashFunctions; i++) {
Reported by PMD.
Line: 130
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
byte[] bytes = Hashing.murmur3_128().hashObject(object, funnel).getBytesInternal();
long hash1 = lowerEight(bytes);
long hash2 = upperEight(bytes);
long combinedHash = hash1;
for (int i = 0; i < numHashFunctions; i++) {
Reported by PMD.
Line: 164
*/
static final class LockFreeBitArray {
private static final int LONG_ADDRESSABLE_BITS = 6;
final AtomicLongArray data;
private final LongAddable bitCount;
LockFreeBitArray(long bits) {
checkArgument(bits > 0, "data length is zero!");
// Avoid delegating to this(long[]), since AtomicLongArray(long[]) will clone its input and
Reported by PMD.
Line: 165
static final class LockFreeBitArray {
private static final int LONG_ADDRESSABLE_BITS = 6;
final AtomicLongArray data;
private final LongAddable bitCount;
LockFreeBitArray(long bits) {
checkArgument(bits > 0, "data length is zero!");
// Avoid delegating to this(long[]), since AtomicLongArray(long[]) will clone its input and
// thus double memory usage.
Reported by PMD.
guava/src/com/google/common/collect/Range.java
29 issues
Line: 121
@GwtCompatible
@SuppressWarnings("rawtypes")
@ElementTypesAreNonnullByDefault
public final class Range<C extends Comparable> extends RangeGwtSerializationDependencies
implements Predicate<C>, Serializable {
static class LowerBoundFn implements Function<Range, Cut> {
static final LowerBoundFn INSTANCE = new LowerBoundFn();
Reported by PMD.
Line: 121
@GwtCompatible
@SuppressWarnings("rawtypes")
@ElementTypesAreNonnullByDefault
public final class Range<C extends Comparable> extends RangeGwtSerializationDependencies
implements Predicate<C>, Serializable {
static class LowerBoundFn implements Function<Range, Cut> {
static final LowerBoundFn INSTANCE = new LowerBoundFn();
Reported by PMD.
Line: 122
@SuppressWarnings("rawtypes")
@ElementTypesAreNonnullByDefault
public final class Range<C extends Comparable> extends RangeGwtSerializationDependencies
implements Predicate<C>, Serializable {
static class LowerBoundFn implements Function<Range, Cut> {
static final LowerBoundFn INSTANCE = new LowerBoundFn();
@Override
Reported by PMD.
Line: 142
}
}
@SuppressWarnings("unchecked")
static <C extends Comparable<?>> Function<Range<C>, Cut<C>> lowerBoundFn() {
return (Function) LowerBoundFn.INSTANCE;
}
@SuppressWarnings("unchecked")
Reported by PMD.
Line: 299
}
}
private static final Range<Comparable> ALL = new Range<>(Cut.belowAll(), Cut.aboveAll());
/**
* Returns a range that contains every value of type {@code C}.
*
* @since 14.0
Reported by PMD.
Line: 334
checkNotNull(values);
if (values instanceof SortedSet) {
SortedSet<C> set = (SortedSet<C>) values;
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return closed(set.first(), set.last());
}
}
Iterator<C> valueIterator = values.iterator();
Reported by PMD.
Line: 335
if (values instanceof SortedSet) {
SortedSet<C> set = (SortedSet<C>) values;
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return closed(set.first(), set.last());
}
}
Iterator<C> valueIterator = values.iterator();
C min = checkNotNull(valueIterator.next());
Reported by PMD.
Line: 336
SortedSet<C> set = (SortedSet<C>) values;
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return closed(set.first(), set.last());
}
}
Iterator<C> valueIterator = values.iterator();
C min = checkNotNull(valueIterator.next());
C max = min;
Reported by PMD.
Line: 336
SortedSet<C> set = (SortedSet<C>) values;
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return closed(set.first(), set.last());
}
}
Iterator<C> valueIterator = values.iterator();
C min = checkNotNull(valueIterator.next());
C max = min;
Reported by PMD.
Line: 344
C max = min;
while (valueIterator.hasNext()) {
C value = checkNotNull(valueIterator.next());
min = Ordering.natural().min(min, value);
max = Ordering.natural().max(max, value);
}
return closed(min, max);
}
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java
29 issues
Line: 82
okayToRun.await();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
runCalled.getAndIncrement();
}
},
directExecutor());
Reported by PMD.
Line: 161
new Runnable() {
@Override
public void run() {
throw new RuntimeException();
}
};
}
Reported by PMD.
Line: 37
*/
public class ExecutionListTest extends TestCase {
private final ExecutionList list = new ExecutionList();
public void testRunOnPopulatedList() throws Exception {
Executor exec = Executors.newCachedThreadPool();
CountDownLatch countDownLatch = new CountDownLatch(3);
Reported by PMD.
Line: 40
private final ExecutionList list = new ExecutionList();
public void testRunOnPopulatedList() throws Exception {
Executor exec = Executors.newCachedThreadPool();
CountDownLatch countDownLatch = new CountDownLatch(3);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
Reported by PMD.
Line: 40
private final ExecutionList list = new ExecutionList();
public void testRunOnPopulatedList() throws Exception {
Executor exec = Executors.newCachedThreadPool();
CountDownLatch countDownLatch = new CountDownLatch(3);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
Reported by PMD.
Line: 46
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
assertEquals(3L, countDownLatch.getCount());
list.execute();
// Verify that all of the runnables execute in a reasonable amount of time.
assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
Reported by PMD.
Line: 51
list.execute();
// Verify that all of the runnables execute in a reasonable amount of time.
assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
}
public void testExecute_idempotent() {
final AtomicInteger runCalled = new AtomicInteger();
list.add(
Reported by PMD.
Line: 54
assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
}
public void testExecute_idempotent() {
final AtomicInteger runCalled = new AtomicInteger();
list.add(
new Runnable() {
@Override
public void run() {
Reported by PMD.
Line: 54
assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
}
public void testExecute_idempotent() {
final AtomicInteger runCalled = new AtomicInteger();
list.add(
new Runnable() {
@Override
public void run() {
Reported by PMD.
Line: 65
},
directExecutor());
list.execute();
assertEquals(1, runCalled.get());
list.execute();
assertEquals(1, runCalled.get());
}
Reported by PMD.
android/guava/src/com/google/common/collect/Range.java
29 issues
Line: 121
@GwtCompatible
@SuppressWarnings("rawtypes")
@ElementTypesAreNonnullByDefault
public final class Range<C extends Comparable> extends RangeGwtSerializationDependencies
implements Predicate<C>, Serializable {
static class LowerBoundFn implements Function<Range, Cut> {
static final LowerBoundFn INSTANCE = new LowerBoundFn();
Reported by PMD.
Line: 121
@GwtCompatible
@SuppressWarnings("rawtypes")
@ElementTypesAreNonnullByDefault
public final class Range<C extends Comparable> extends RangeGwtSerializationDependencies
implements Predicate<C>, Serializable {
static class LowerBoundFn implements Function<Range, Cut> {
static final LowerBoundFn INSTANCE = new LowerBoundFn();
Reported by PMD.
Line: 122
@SuppressWarnings("rawtypes")
@ElementTypesAreNonnullByDefault
public final class Range<C extends Comparable> extends RangeGwtSerializationDependencies
implements Predicate<C>, Serializable {
static class LowerBoundFn implements Function<Range, Cut> {
static final LowerBoundFn INSTANCE = new LowerBoundFn();
@Override
Reported by PMD.
Line: 142
}
}
@SuppressWarnings("unchecked")
static <C extends Comparable<?>> Function<Range<C>, Cut<C>> lowerBoundFn() {
return (Function) LowerBoundFn.INSTANCE;
}
@SuppressWarnings("unchecked")
Reported by PMD.
Line: 299
}
}
private static final Range<Comparable> ALL = new Range<>(Cut.belowAll(), Cut.aboveAll());
/**
* Returns a range that contains every value of type {@code C}.
*
* @since 14.0
Reported by PMD.
Line: 334
checkNotNull(values);
if (values instanceof SortedSet) {
SortedSet<C> set = (SortedSet<C>) values;
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return closed(set.first(), set.last());
}
}
Iterator<C> valueIterator = values.iterator();
Reported by PMD.
Line: 335
if (values instanceof SortedSet) {
SortedSet<C> set = (SortedSet<C>) values;
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return closed(set.first(), set.last());
}
}
Iterator<C> valueIterator = values.iterator();
C min = checkNotNull(valueIterator.next());
Reported by PMD.
Line: 336
SortedSet<C> set = (SortedSet<C>) values;
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return closed(set.first(), set.last());
}
}
Iterator<C> valueIterator = values.iterator();
C min = checkNotNull(valueIterator.next());
C max = min;
Reported by PMD.
Line: 336
SortedSet<C> set = (SortedSet<C>) values;
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return closed(set.first(), set.last());
}
}
Iterator<C> valueIterator = values.iterator();
C min = checkNotNull(valueIterator.next());
C max = min;
Reported by PMD.
Line: 344
C max = min;
while (valueIterator.hasNext()) {
C value = checkNotNull(valueIterator.next());
min = Ordering.natural().min(min, value);
max = Ordering.natural().max(max, value);
}
return closed(min, max);
}
Reported by PMD.
android/guava/src/com/google/common/collect/ImmutableSetMultimap.java
29 issues
Line: 57
*/
@GwtCompatible(serializable = true, emulated = true)
@ElementTypesAreNonnullByDefault
public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V>
implements SetMultimap<K, V> {
/**
* Returns the empty multimap.
*
Reported by PMD.
Line: 58
@GwtCompatible(serializable = true, emulated = true)
@ElementTypesAreNonnullByDefault
public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V>
implements SetMultimap<K, V> {
/**
* Returns the empty multimap.
*
* <p><b>Performance note:</b> the instance returned is a singleton.
Reported by PMD.
Line: 119
* Returns an immutable multimap containing the given entries, in order. Repeated occurrences of
* an entry (according to {@link Object#equals}) after the first are ignored.
*/
public static <K, V> ImmutableSetMultimap<K, V> of(
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
ImmutableSetMultimap.Builder<K, V> builder = ImmutableSetMultimap.builder();
builder.put(k1, v1);
builder.put(k2, v2);
builder.put(k3, v3);
Reported by PMD.
Line: 156
*
* @since 2.0
*/
public static final class Builder<K, V> extends ImmutableMultimap.Builder<K, V> {
/**
* Creates a new builder. The returned builder is equivalent to the builder generated by {@link
* ImmutableSetMultimap#builder}.
*/
public Builder() {
Reported by PMD.
Line: 220
@Override
public Builder<K, V> putAll(Multimap<? extends K, ? extends V> multimap) {
for (Entry<? extends K, ? extends Collection<? extends V>> entry :
multimap.asMap().entrySet()) {
putAll(entry.getKey(), entry.getValue());
}
return this;
}
Reported by PMD.
Line: 268
public ImmutableSetMultimap<K, V> build() {
Collection<Map.Entry<K, Collection<V>>> mapEntries = builderMap.entrySet();
if (keyComparator != null) {
mapEntries = Ordering.from(keyComparator).<K>onKeys().immutableSortedCopy(mapEntries);
}
return fromMapEntries(mapEntries, valueComparator);
}
}
Reported by PMD.
Line: 268
public ImmutableSetMultimap<K, V> build() {
Collection<Map.Entry<K, Collection<V>>> mapEntries = builderMap.entrySet();
if (keyComparator != null) {
mapEntries = Ordering.from(keyComparator).<K>onKeys().immutableSortedCopy(mapEntries);
}
return fromMapEntries(mapEntries, valueComparator);
}
}
Reported by PMD.
Line: 302
if (multimap instanceof ImmutableSetMultimap) {
@SuppressWarnings("unchecked") // safe since multimap is not writable
ImmutableSetMultimap<K, V> kvMultimap = (ImmutableSetMultimap<K, V>) multimap;
if (!kvMultimap.isPartialView()) {
return kvMultimap;
}
}
return fromMapEntries(multimap.asMap().entrySet(), valueComparator);
Reported by PMD.
Line: 307
}
}
return fromMapEntries(multimap.asMap().entrySet(), valueComparator);
}
/**
* Returns an immutable multimap containing the specified entries. The returned multimap iterates
* over keys in the order they were first encountered in the input, and the values for each key
Reported by PMD.
Line: 340
K key = entry.getKey();
Collection<? extends V> values = entry.getValue();
ImmutableSet<V> set = valueSet(valueComparator, values);
if (!set.isEmpty()) {
builder.put(key, set);
size += set.size();
}
}
Reported by PMD.
android/guava/src/com/google/common/hash/BloomFilterStrategies.java
29 issues
Line: 55
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
long hash64 = Hashing.murmur3_128().hashObject(object, funnel).asLong();
int hash1 = (int) hash64;
int hash2 = (int) (hash64 >>> 32);
boolean bitsChanged = false;
for (int i = 1; i <= numHashFunctions; i++) {
Reported by PMD.
Line: 55
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
long hash64 = Hashing.murmur3_128().hashObject(object, funnel).asLong();
int hash1 = (int) hash64;
int hash2 = (int) (hash64 >>> 32);
boolean bitsChanged = false;
for (int i = 1; i <= numHashFunctions; i++) {
Reported by PMD.
Line: 78
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
long hash64 = Hashing.murmur3_128().hashObject(object, funnel).asLong();
int hash1 = (int) hash64;
int hash2 = (int) (hash64 >>> 32);
for (int i = 1; i <= numHashFunctions; i++) {
int combinedHash = hash1 + (i * hash2);
Reported by PMD.
Line: 78
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
long hash64 = Hashing.murmur3_128().hashObject(object, funnel).asLong();
int hash1 = (int) hash64;
int hash2 = (int) (hash64 >>> 32);
for (int i = 1; i <= numHashFunctions; i++) {
int combinedHash = hash1 + (i * hash2);
Reported by PMD.
Line: 109
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
byte[] bytes = Hashing.murmur3_128().hashObject(object, funnel).getBytesInternal();
long hash1 = lowerEight(bytes);
long hash2 = upperEight(bytes);
boolean bitsChanged = false;
long combinedHash = hash1;
Reported by PMD.
Line: 109
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
byte[] bytes = Hashing.murmur3_128().hashObject(object, funnel).getBytesInternal();
long hash1 = lowerEight(bytes);
long hash2 = upperEight(bytes);
boolean bitsChanged = false;
long combinedHash = hash1;
Reported by PMD.
Line: 130
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
byte[] bytes = Hashing.murmur3_128().hashObject(object, funnel).getBytesInternal();
long hash1 = lowerEight(bytes);
long hash2 = upperEight(bytes);
long combinedHash = hash1;
for (int i = 0; i < numHashFunctions; i++) {
Reported by PMD.
Line: 130
int numHashFunctions,
LockFreeBitArray bits) {
long bitSize = bits.bitSize();
byte[] bytes = Hashing.murmur3_128().hashObject(object, funnel).getBytesInternal();
long hash1 = lowerEight(bytes);
long hash2 = upperEight(bytes);
long combinedHash = hash1;
for (int i = 0; i < numHashFunctions; i++) {
Reported by PMD.
Line: 164
*/
static final class LockFreeBitArray {
private static final int LONG_ADDRESSABLE_BITS = 6;
final AtomicLongArray data;
private final LongAddable bitCount;
LockFreeBitArray(long bits) {
checkArgument(bits > 0, "data length is zero!");
// Avoid delegating to this(long[]), since AtomicLongArray(long[]) will clone its input and
Reported by PMD.
Line: 165
static final class LockFreeBitArray {
private static final int LONG_ADDRESSABLE_BITS = 6;
final AtomicLongArray data;
private final LongAddable bitCount;
LockFreeBitArray(long bits) {
checkArgument(bits > 0, "data length is zero!");
// Avoid delegating to this(long[]), since AtomicLongArray(long[]) will clone its input and
// thus double memory usage.
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java
29 issues
Line: 82
okayToRun.await();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
runCalled.getAndIncrement();
}
},
directExecutor());
Reported by PMD.
Line: 161
new Runnable() {
@Override
public void run() {
throw new RuntimeException();
}
};
}
Reported by PMD.
Line: 37
*/
public class ExecutionListTest extends TestCase {
private final ExecutionList list = new ExecutionList();
public void testRunOnPopulatedList() throws Exception {
Executor exec = Executors.newCachedThreadPool();
CountDownLatch countDownLatch = new CountDownLatch(3);
Reported by PMD.
Line: 40
private final ExecutionList list = new ExecutionList();
public void testRunOnPopulatedList() throws Exception {
Executor exec = Executors.newCachedThreadPool();
CountDownLatch countDownLatch = new CountDownLatch(3);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
Reported by PMD.
Line: 40
private final ExecutionList list = new ExecutionList();
public void testRunOnPopulatedList() throws Exception {
Executor exec = Executors.newCachedThreadPool();
CountDownLatch countDownLatch = new CountDownLatch(3);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
Reported by PMD.
Line: 46
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
list.add(new MockRunnable(countDownLatch), exec);
assertEquals(3L, countDownLatch.getCount());
list.execute();
// Verify that all of the runnables execute in a reasonable amount of time.
assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
Reported by PMD.
Line: 51
list.execute();
// Verify that all of the runnables execute in a reasonable amount of time.
assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
}
public void testExecute_idempotent() {
final AtomicInteger runCalled = new AtomicInteger();
list.add(
Reported by PMD.
Line: 54
assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
}
public void testExecute_idempotent() {
final AtomicInteger runCalled = new AtomicInteger();
list.add(
new Runnable() {
@Override
public void run() {
Reported by PMD.
Line: 54
assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
}
public void testExecute_idempotent() {
final AtomicInteger runCalled = new AtomicInteger();
list.add(
new Runnable() {
@Override
public void run() {
Reported by PMD.
Line: 65
},
directExecutor());
list.execute();
assertEquals(1, runCalled.get());
list.execute();
assertEquals(1, runCalled.get());
}
Reported by PMD.
android/guava/src/com/google/common/collect/SortedMultisets.java
29 issues
Line: 48
@SuppressWarnings("JdkObsolete") // TODO(b/6160855): Switch GWT emulations to NavigableSet.
static class ElementSet<E extends @Nullable Object> extends Multisets.ElementSet<E>
implements SortedSet<E> {
@Weak private final SortedMultiset<E> multiset;
ElementSet(SortedMultiset<E> multiset) {
this.multiset = multiset;
}
Reported by PMD.
Line: 48
@SuppressWarnings("JdkObsolete") // TODO(b/6160855): Switch GWT emulations to NavigableSet.
static class ElementSet<E extends @Nullable Object> extends Multisets.ElementSet<E>
implements SortedSet<E> {
@Weak private final SortedMultiset<E> multiset;
ElementSet(SortedMultiset<E> multiset) {
this.multiset = multiset;
}
Reported by PMD.
Line: 61
@Override
public Iterator<E> iterator() {
return Multisets.elementIterator(multiset().entrySet().iterator());
}
@Override
public Comparator<? super E> comparator() {
return multiset().comparator();
Reported by PMD.
Line: 61
@Override
public Iterator<E> iterator() {
return Multisets.elementIterator(multiset().entrySet().iterator());
}
@Override
public Comparator<? super E> comparator() {
return multiset().comparator();
Reported by PMD.
Line: 66
@Override
public Comparator<? super E> comparator() {
return multiset().comparator();
}
@Override
public SortedSet<E> subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) {
return multiset().subMultiset(fromElement, CLOSED, toElement, OPEN).elementSet();
Reported by PMD.
Line: 71
@Override
public SortedSet<E> subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) {
return multiset().subMultiset(fromElement, CLOSED, toElement, OPEN).elementSet();
}
@Override
public SortedSet<E> headSet(@ParametricNullness E toElement) {
return multiset().headMultiset(toElement, OPEN).elementSet();
Reported by PMD.
Line: 71
@Override
public SortedSet<E> subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) {
return multiset().subMultiset(fromElement, CLOSED, toElement, OPEN).elementSet();
}
@Override
public SortedSet<E> headSet(@ParametricNullness E toElement) {
return multiset().headMultiset(toElement, OPEN).elementSet();
Reported by PMD.
Line: 76
@Override
public SortedSet<E> headSet(@ParametricNullness E toElement) {
return multiset().headMultiset(toElement, OPEN).elementSet();
}
@Override
public SortedSet<E> tailSet(@ParametricNullness E fromElement) {
return multiset().tailMultiset(fromElement, CLOSED).elementSet();
Reported by PMD.
Line: 76
@Override
public SortedSet<E> headSet(@ParametricNullness E toElement) {
return multiset().headMultiset(toElement, OPEN).elementSet();
}
@Override
public SortedSet<E> tailSet(@ParametricNullness E fromElement) {
return multiset().tailMultiset(fromElement, CLOSED).elementSet();
Reported by PMD.
Line: 81
@Override
public SortedSet<E> tailSet(@ParametricNullness E fromElement) {
return multiset().tailMultiset(fromElement, CLOSED).elementSet();
}
@Override
@ParametricNullness
public E first() {
Reported by PMD.
android/guava/src/com/google/common/base/Preconditions.java
29 issues
Line: 889
@CanIgnoreReturnValue
public static <T> T checkNotNull(@CheckForNull T reference) {
if (reference == null) {
throw new NullPointerException();
}
return reference;
}
/**
Reported by PMD.
Line: 907
@CanIgnoreReturnValue
public static <T> T checkNotNull(@CheckForNull T reference, @CheckForNull Object errorMessage) {
if (reference == null) {
throw new NullPointerException(String.valueOf(errorMessage));
}
return reference;
}
/**
Reported by PMD.
Line: 933
String errorMessageTemplate,
@CheckForNull @Nullable Object... errorMessageArgs) {
if (reference == null) {
throw new NullPointerException(lenientFormat(errorMessageTemplate, errorMessageArgs));
}
return reference;
}
/**
Reported by PMD.
Line: 948
@CanIgnoreReturnValue
public static <T> T checkNotNull(@CheckForNull T obj, String errorMessageTemplate, char p1) {
if (obj == null) {
throw new NullPointerException(lenientFormat(errorMessageTemplate, p1));
}
return obj;
}
/**
Reported by PMD.
Line: 963
@CanIgnoreReturnValue
public static <T> T checkNotNull(@CheckForNull T obj, String errorMessageTemplate, int p1) {
if (obj == null) {
throw new NullPointerException(lenientFormat(errorMessageTemplate, p1));
}
return obj;
}
/**
Reported by PMD.
Line: 978
@CanIgnoreReturnValue
public static <T> T checkNotNull(@CheckForNull T obj, String errorMessageTemplate, long p1) {
if (obj == null) {
throw new NullPointerException(lenientFormat(errorMessageTemplate, p1));
}
return obj;
}
/**
Reported by PMD.
Line: 994
public static <T> T checkNotNull(
@CheckForNull T obj, String errorMessageTemplate, @CheckForNull Object p1) {
if (obj == null) {
throw new NullPointerException(lenientFormat(errorMessageTemplate, p1));
}
return obj;
}
/**
Reported by PMD.
Line: 1010
public static <T> T checkNotNull(
@CheckForNull T obj, String errorMessageTemplate, char p1, char p2) {
if (obj == null) {
throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2));
}
return obj;
}
/**
Reported by PMD.
Line: 1026
public static <T> T checkNotNull(
@CheckForNull T obj, String errorMessageTemplate, char p1, int p2) {
if (obj == null) {
throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2));
}
return obj;
}
/**
Reported by PMD.
Line: 1042
public static <T> T checkNotNull(
@CheckForNull T obj, String errorMessageTemplate, char p1, long p2) {
if (obj == null) {
throw new NullPointerException(lenientFormat(errorMessageTemplate, p1, p2));
}
return obj;
}
/**
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/MapEqualsTester.java
29 issues
Line: 42
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapEqualsTester<K, V> extends AbstractMapTester<K, V> {
public void testEquals_otherMapWithSameEntries() {
assertTrue(
"A Map should equal any other Map containing the same entries.",
getMap().equals(newHashMap(getSampleEntries())));
}
Reported by PMD.
Line: 45
public void testEquals_otherMapWithSameEntries() {
assertTrue(
"A Map should equal any other Map containing the same entries.",
getMap().equals(newHashMap(getSampleEntries())));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherMapWithDifferentEntries() {
Map<K, V> other = newHashMap(getSampleEntries(getNumEntries() - 1));
Reported by PMD.
Line: 48
getMap().equals(newHashMap(getSampleEntries())));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherMapWithDifferentEntries() {
Map<K, V> other = newHashMap(getSampleEntries(getNumEntries() - 1));
other.put(k3(), v3());
assertFalse(
"A Map should not equal another Map containing different entries.", getMap().equals(other));
Reported by PMD.
Line: 51
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherMapWithDifferentEntries() {
Map<K, V> other = newHashMap(getSampleEntries(getNumEntries() - 1));
other.put(k3(), v3());
assertFalse(
"A Map should not equal another Map containing different entries.", getMap().equals(other));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
Reported by PMD.
Line: 53
Map<K, V> other = newHashMap(getSampleEntries(getNumEntries() - 1));
other.put(k3(), v3());
assertFalse(
"A Map should not equal another Map containing different entries.", getMap().equals(other));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
@MapFeature.Require(ALLOWS_NULL_KEYS)
public void testEquals_containingNullKey() {
Reported by PMD.
Line: 56
"A Map should not equal another Map containing different entries.", getMap().equals(other));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
@MapFeature.Require(ALLOWS_NULL_KEYS)
public void testEquals_containingNullKey() {
Collection<Entry<K, V>> entries = getSampleEntries(getNumEntries() - 1);
entries.add(entry(null, v3()));
Reported by PMD.
Line: 60
@MapFeature.Require(ALLOWS_NULL_KEYS)
public void testEquals_containingNullKey() {
Collection<Entry<K, V>> entries = getSampleEntries(getNumEntries() - 1);
entries.add(entry(null, v3()));
resetContainer(getSubjectGenerator().create(entries.toArray()));
assertTrue(
"A Map should equal any other Map containing the same entries,"
+ " even if some keys are null.",
Reported by PMD.
Line: 62
Collection<Entry<K, V>> entries = getSampleEntries(getNumEntries() - 1);
entries.add(entry(null, v3()));
resetContainer(getSubjectGenerator().create(entries.toArray()));
assertTrue(
"A Map should equal any other Map containing the same entries,"
+ " even if some keys are null.",
getMap().equals(newHashMap(entries)));
}
Reported by PMD.
Line: 62
Collection<Entry<K, V>> entries = getSampleEntries(getNumEntries() - 1);
entries.add(entry(null, v3()));
resetContainer(getSubjectGenerator().create(entries.toArray()));
assertTrue(
"A Map should equal any other Map containing the same entries,"
+ " even if some keys are null.",
getMap().equals(newHashMap(entries)));
}
Reported by PMD.
Line: 66
assertTrue(
"A Map should equal any other Map containing the same entries,"
+ " even if some keys are null.",
getMap().equals(newHashMap(entries)));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherContainsNullKey() {
Collection<Entry<K, V>> entries = getSampleEntries(getNumEntries() - 1);
Reported by PMD.