The following issues were found
guava/src/com/google/common/math/Stats.java
37 issues
Line: 68
@Beta
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Stats implements Serializable {
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
Reported by PMD.
Line: 68
@Beta
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Stats implements Serializable {
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
Reported by PMD.
Line: 70
@ElementTypesAreNonnullByDefault
public final class Stats implements Serializable {
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
private final double max;
Reported by PMD.
Line: 70
@ElementTypesAreNonnullByDefault
public final class Stats implements Serializable {
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
private final double max;
Reported by PMD.
Line: 71
public final class Stats implements Serializable {
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
private final double max;
/**
Reported by PMD.
Line: 71
public final class Stats implements Serializable {
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
private final double max;
/**
Reported by PMD.
Line: 72
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
private final double max;
/**
* Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.
Reported by PMD.
Line: 72
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
private final double max;
/**
* Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.
Reported by PMD.
Line: 73
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
private final double max;
/**
* Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.
*
Reported by PMD.
Line: 73
private final long count;
private final double mean;
private final double sumOfSquaresOfDeltas;
private final double min;
private final double max;
/**
* Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.
*
Reported by PMD.
guava/src/com/google/common/util/concurrent/Uninterruptibles.java
37 issues
Line: 50
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Uninterruptibles {
// Implementation Note: As of 3-7-11, the logic for each blocking/timeout
// methods is identical, save for method being invoked.
/** Invokes {@code latch.}{@link CountDownLatch#await() await()} uninterruptibly. */
Reported by PMD.
Line: 50
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Uninterruptibles {
// Implementation Note: As of 3-7-11, the logic for each blocking/timeout
// methods is identical, save for method being invoked.
/** Invokes {@code latch.}{@link CountDownLatch#await() await()} uninterruptibly. */
Reported by PMD.
Line: 70
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
}
/**
Reported by PMD.
Line: 94
*/
@CanIgnoreReturnValue // TODO(cpovirk): Consider being more strict.
@GwtIncompatible // concurrency
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
public static boolean awaitUninterruptibly(CountDownLatch latch, long timeout, TimeUnit unit) {
boolean interrupted = false;
try {
long remainingNanos = unit.toNanos(timeout);
long end = System.nanoTime() + remainingNanos;
Reported by PMD.
Line: 112
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
}
/**
Reported by PMD.
Line: 153
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
}
/** Invokes {@code toJoin.}{@link Thread#join() join()} uninterruptibly. */
Reported by PMD.
Line: 173
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
}
/**
Reported by PMD.
Line: 214
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
}
/**
Reported by PMD.
Line: 251
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
}
/**
Reported by PMD.
Line: 324
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
}
/** Invokes {@code queue.}{@link BlockingQueue#take() take()} uninterruptibly. */
Reported by PMD.
guava/src/com/google/common/util/concurrent/Futures.java
37 issues
Line: 15
* the License.
*/
package com.google.common.util.concurrent;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.util.concurrent.Internal.toNanosSaturated;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.util.concurrent;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.util.concurrent.Internal.toNanosSaturated;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
Reported by PMD.
Line: 79
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Futures extends GwtFuturesCatchingSpecialization {
// A note on memory visibility.
// Many of the utilities in this class (transform, withFallback, withTimeout, asList, combine)
// have two requirements that significantly complicate their design.
// 1. Cancellation should propagate from the returned future to the input future(s).
Reported by PMD.
Line: 79
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Futures extends GwtFuturesCatchingSpecialization {
// A note on memory visibility.
// Many of the utilities in this class (transform, withFallback, withTimeout, asList, combine)
// have two requirements that significantly complicate their design.
// 1. Cancellation should propagate from the returned future to the input future(s).
Reported by PMD.
Line: 137
@ParametricNullness V value) {
if (value == null) {
// This cast is safe because null is assignable to V for all V (i.e. it is bivariant)
@SuppressWarnings("unchecked")
ListenableFuture<V> typedNull = (ListenableFuture<V>) ImmediateFuture.NULL;
return typedNull;
}
return new ImmediateFuture<>(value);
}
Reported by PMD.
Line: 551
private O applyTransformation(I input) throws ExecutionException {
try {
return function.apply(input);
} catch (Throwable t) {
throw new ExecutionException(t);
}
}
};
}
Reported by PMD.
Line: 699
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing, especially if we provide run(Runnable)
@GwtCompatible
public static final class FutureCombiner<V extends @Nullable Object> {
private final boolean allMustSucceed;
private final ImmutableList<ListenableFuture<? extends V>> futures;
private FutureCombiner(
boolean allMustSucceed, ImmutableList<ListenableFuture<? extends V>> futures) {
this.allMustSucceed = allMustSucceed;
Reported by PMD.
Line: 700
@GwtCompatible
public static final class FutureCombiner<V extends @Nullable Object> {
private final boolean allMustSucceed;
private final ImmutableList<ListenableFuture<? extends V>> futures;
private FutureCombiner(
boolean allMustSucceed, ImmutableList<ListenableFuture<? extends V>> futures) {
this.allMustSucceed = allMustSucceed;
this.futures = futures;
Reported by PMD.
Line: 793
/** A wrapped future that does not propagate cancellation to its delegate. */
private static final class NonCancellationPropagatingFuture<V extends @Nullable Object>
extends AbstractFuture.TrustedFuture<V> implements Runnable {
@CheckForNull private ListenableFuture<V> delegate;
NonCancellationPropagatingFuture(final ListenableFuture<V> delegate) {
this.delegate = delegate;
}
Reported by PMD.
Line: 821
@Override
protected void afterDone() {
delegate = null;
}
}
/**
* Creates a new {@code ListenableFuture} whose value is a list containing the values of all its
Reported by PMD.
guava/src/com/google/common/collect/AbstractBiMap.java
37 issues
Line: 60
/** Package-private constructor for creating a map-backed bimap. */
AbstractBiMap(Map<K, V> forward, Map<V, K> backward) {
setDelegates(forward, backward);
}
/** Private constructor for inverse bimap. */
private AbstractBiMap(Map<K, V> backward, AbstractBiMap<V, K> forward) {
delegate = backward;
Reported by PMD.
Line: 53
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class AbstractBiMap<K extends @Nullable Object, V extends @Nullable Object>
extends ForwardingMap<K, V> implements BiMap<K, V>, Serializable {
private transient Map<K, V> delegate;
@RetainedWith transient AbstractBiMap<V, K> inverse;
/** Package-private constructor for creating a map-backed bimap. */
Reported by PMD.
Line: 55
abstract class AbstractBiMap<K extends @Nullable Object, V extends @Nullable Object>
extends ForwardingMap<K, V> implements BiMap<K, V>, Serializable {
private transient Map<K, V> delegate;
@RetainedWith transient AbstractBiMap<V, K> inverse;
/** Package-private constructor for creating a map-backed bimap. */
AbstractBiMap(Map<K, V> forward, Map<V, K> backward) {
setDelegates(forward, backward);
Reported by PMD.
Line: 56
extends ForwardingMap<K, V> implements BiMap<K, V>, Serializable {
private transient Map<K, V> delegate;
@RetainedWith transient AbstractBiMap<V, K> inverse;
/** Package-private constructor for creating a map-backed bimap. */
AbstractBiMap(Map<K, V> forward, Map<V, K> backward) {
setDelegates(forward, backward);
}
Reported by PMD.
Line: 97
checkState(inverse == null);
checkArgument(forward.isEmpty());
checkArgument(backward.isEmpty());
checkArgument(forward != backward);
delegate = forward;
inverse = makeInverse(backward);
}
AbstractBiMap<V, K> makeInverse(Map<V, K> backward) {
Reported by PMD.
Line: 142
return value;
}
if (force) {
inverse().remove(value);
} else {
checkArgument(!containsValue(value), "value already present: %s", value);
}
V oldValue = delegate.put(key, value);
updateInverseMap(key, containedKey, oldValue, value);
Reported by PMD.
Line: 160
// The cast is safe because of the containedKey check.
removeFromInverseMap(uncheckedCastNullableTToT(oldValue));
}
inverse.delegate.put(newValue, key);
}
@CanIgnoreReturnValue
@Override
@CheckForNull
Reported by PMD.
Line: 180
}
private void removeFromInverseMap(@ParametricNullness V oldValue) {
inverse.delegate.remove(oldValue);
}
// Bulk Operations
@Override
Reported by PMD.
Line: 195
@Override
public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
this.delegate.replaceAll(function);
inverse.delegate.clear();
Entry<K, V> broken = null;
Iterator<Entry<K, V>> itr = this.delegate.entrySet().iterator();
while (itr.hasNext()) {
Entry<K, V> entry = itr.next();
K k = entry.getKey();
Reported by PMD.
Line: 200
Iterator<Entry<K, V>> itr = this.delegate.entrySet().iterator();
while (itr.hasNext()) {
Entry<K, V> entry = itr.next();
K k = entry.getKey();
V v = entry.getValue();
K conflict = inverse.delegate.putIfAbsent(v, k);
if (conflict != null) {
broken = entry;
// We're definitely going to throw, but we'll try to keep the BiMap in an internally
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/MultisetReadsTester.java
37 issues
Line: 37
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetReadsTester<E> extends AbstractMultisetTester<E> {
@CollectionSize.Require(absent = ZERO)
public void testElementSet_contains() {
assertTrue(
"multiset.elementSet().contains(present) returned false",
Reported by PMD.
Line: 39
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetReadsTester<E> extends AbstractMultisetTester<E> {
@CollectionSize.Require(absent = ZERO)
public void testElementSet_contains() {
assertTrue(
"multiset.elementSet().contains(present) returned false",
getMultiset().elementSet().contains(e0()));
}
Reported by PMD.
Line: 43
public void testElementSet_contains() {
assertTrue(
"multiset.elementSet().contains(present) returned false",
getMultiset().elementSet().contains(e0()));
}
@CollectionSize.Require(absent = ZERO)
public void testEntrySet_contains() {
assertTrue(
Reported by PMD.
Line: 43
public void testElementSet_contains() {
assertTrue(
"multiset.elementSet().contains(present) returned false",
getMultiset().elementSet().contains(e0()));
}
@CollectionSize.Require(absent = ZERO)
public void testEntrySet_contains() {
assertTrue(
Reported by PMD.
Line: 46
getMultiset().elementSet().contains(e0()));
}
@CollectionSize.Require(absent = ZERO)
public void testEntrySet_contains() {
assertTrue(
"multiset.entrySet() didn't contain [present, 1]",
getMultiset().entrySet().contains(Multisets.immutableEntry(e0(), 1)));
}
Reported by PMD.
Line: 50
public void testEntrySet_contains() {
assertTrue(
"multiset.entrySet() didn't contain [present, 1]",
getMultiset().entrySet().contains(Multisets.immutableEntry(e0(), 1)));
}
public void testEntrySet_contains_count0() {
assertFalse(
"multiset.entrySet() contains [missing, 0]",
Reported by PMD.
Line: 50
public void testEntrySet_contains() {
assertTrue(
"multiset.entrySet() didn't contain [present, 1]",
getMultiset().entrySet().contains(Multisets.immutableEntry(e0(), 1)));
}
public void testEntrySet_contains_count0() {
assertFalse(
"multiset.entrySet() contains [missing, 0]",
Reported by PMD.
Line: 53
getMultiset().entrySet().contains(Multisets.immutableEntry(e0(), 1)));
}
public void testEntrySet_contains_count0() {
assertFalse(
"multiset.entrySet() contains [missing, 0]",
getMultiset().entrySet().contains(Multisets.immutableEntry(e3(), 0)));
}
Reported by PMD.
Line: 56
public void testEntrySet_contains_count0() {
assertFalse(
"multiset.entrySet() contains [missing, 0]",
getMultiset().entrySet().contains(Multisets.immutableEntry(e3(), 0)));
}
public void testEntrySet_contains_nonentry() {
assertFalse(
"multiset.entrySet() contains a non-entry", getMultiset().entrySet().contains(e0()));
Reported by PMD.
Line: 56
public void testEntrySet_contains_count0() {
assertFalse(
"multiset.entrySet() contains [missing, 0]",
getMultiset().entrySet().contains(Multisets.immutableEntry(e3(), 0)));
}
public void testEntrySet_contains_nonentry() {
assertFalse(
"multiset.entrySet() contains a non-entry", getMultiset().entrySet().contains(e0()));
Reported by PMD.
guava-tests/test/com/google/common/collect/AbstractHashFloodingTest.java
37 issues
Line: 40
*/
@GwtCompatible
public abstract class AbstractHashFloodingTest<T> extends TestCase {
private final List<Construction<T>> constructions;
private final IntToDoubleFunction constructionAsymptotics;
private final List<QueryOp<T>> queries;
AbstractHashFloodingTest(
List<Construction<T>> constructions,
Reported by PMD.
Line: 41
@GwtCompatible
public abstract class AbstractHashFloodingTest<T> extends TestCase {
private final List<Construction<T>> constructions;
private final IntToDoubleFunction constructionAsymptotics;
private final List<QueryOp<T>> queries;
AbstractHashFloodingTest(
List<Construction<T>> constructions,
IntToDoubleFunction constructionAsymptotics,
Reported by PMD.
Line: 42
public abstract class AbstractHashFloodingTest<T> extends TestCase {
private final List<Construction<T>> constructions;
private final IntToDoubleFunction constructionAsymptotics;
private final List<QueryOp<T>> queries;
AbstractHashFloodingTest(
List<Construction<T>> constructions,
IntToDoubleFunction constructionAsymptotics,
List<QueryOp<T>> queries) {
Reported by PMD.
Line: 58
* compareTo.
*/
private static class CountsHashCodeAndEquals implements Comparable<CountsHashCodeAndEquals> {
private final String delegateString;
private final Runnable onHashCode;
private final Runnable onEquals;
private final Runnable onCompareTo;
CountsHashCodeAndEquals(
Reported by PMD.
Line: 59
*/
private static class CountsHashCodeAndEquals implements Comparable<CountsHashCodeAndEquals> {
private final String delegateString;
private final Runnable onHashCode;
private final Runnable onEquals;
private final Runnable onCompareTo;
CountsHashCodeAndEquals(
String delegateString, Runnable onHashCode, Runnable onEquals, Runnable onCompareTo) {
Reported by PMD.
Line: 60
private static class CountsHashCodeAndEquals implements Comparable<CountsHashCodeAndEquals> {
private final String delegateString;
private final Runnable onHashCode;
private final Runnable onEquals;
private final Runnable onCompareTo;
CountsHashCodeAndEquals(
String delegateString, Runnable onHashCode, Runnable onEquals, Runnable onCompareTo) {
this.delegateString = delegateString;
Reported by PMD.
Line: 61
private final String delegateString;
private final Runnable onHashCode;
private final Runnable onEquals;
private final Runnable onCompareTo;
CountsHashCodeAndEquals(
String delegateString, Runnable onHashCode, Runnable onEquals, Runnable onCompareTo) {
this.delegateString = delegateString;
this.onHashCode = onHashCode;
Reported by PMD.
Line: 93
/** A holder of counters for calls to hashCode, equals, and compareTo. */
private static final class CallsCounter {
long hashCode;
long equals;
long compareTo;
long total() {
return hashCode + equals + compareTo;
Reported by PMD.
Line: 94
/** A holder of counters for calls to hashCode, equals, and compareTo. */
private static final class CallsCounter {
long hashCode;
long equals;
long compareTo;
long total() {
return hashCode + equals + compareTo;
}
Reported by PMD.
Line: 95
private static final class CallsCounter {
long hashCode;
long equals;
long compareTo;
long total() {
return hashCode + equals + compareTo;
}
Reported by PMD.
guava-tests/test/com/google/common/cache/ForwardingLoadingCacheTest.java
36 issues
Line: 33
*
* @author Charles Fry
*/
public class ForwardingLoadingCacheTest extends TestCase {
private LoadingCache<String, Boolean> forward;
private LoadingCache<String, Boolean> mock;
@SuppressWarnings({"unchecked", "DoNotMock"}) // mock
@Override
Reported by PMD.
Line: 34
* @author Charles Fry
*/
public class ForwardingLoadingCacheTest extends TestCase {
private LoadingCache<String, Boolean> forward;
private LoadingCache<String, Boolean> mock;
@SuppressWarnings({"unchecked", "DoNotMock"}) // mock
@Override
public void setUp() throws Exception {
Reported by PMD.
Line: 35
*/
public class ForwardingLoadingCacheTest extends TestCase {
private LoadingCache<String, Boolean> forward;
private LoadingCache<String, Boolean> mock;
@SuppressWarnings({"unchecked", "DoNotMock"}) // mock
@Override
public void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 37
private LoadingCache<String, Boolean> forward;
private LoadingCache<String, Boolean> mock;
@SuppressWarnings({"unchecked", "DoNotMock"}) // mock
@Override
public void setUp() throws Exception {
super.setUp();
/*
* Class parameters must be raw, so we can't create a proxy with generic
Reported by PMD.
Line: 56
};
}
public void testGet() throws ExecutionException {
when(mock.get("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.get("key"));
}
public void testGetUnchecked() {
Reported by PMD.
Line: 57
}
public void testGet() throws ExecutionException {
when(mock.get("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.get("key"));
}
public void testGetUnchecked() {
when(mock.getUnchecked("key")).thenReturn(Boolean.TRUE);
Reported by PMD.
Line: 57
}
public void testGet() throws ExecutionException {
when(mock.get("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.get("key"));
}
public void testGetUnchecked() {
when(mock.getUnchecked("key")).thenReturn(Boolean.TRUE);
Reported by PMD.
Line: 58
public void testGet() throws ExecutionException {
when(mock.get("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.get("key"));
}
public void testGetUnchecked() {
when(mock.getUnchecked("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.getUnchecked("key"));
Reported by PMD.
Line: 61
assertSame(Boolean.TRUE, forward.get("key"));
}
public void testGetUnchecked() {
when(mock.getUnchecked("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.getUnchecked("key"));
}
public void testGetAll() throws ExecutionException {
Reported by PMD.
Line: 62
}
public void testGetUnchecked() {
when(mock.getUnchecked("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.getUnchecked("key"));
}
public void testGetAll() throws ExecutionException {
when(mock.getAll(ImmutableList.of("key"))).thenReturn(ImmutableMap.of("key", Boolean.TRUE));
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/MapEntrySetTester.java
36 issues
Line: 55
INSTANCE;
}
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySetIteratorRemove() {
Set<Entry<K, V>> entrySet = getMap().entrySet();
Iterator<Entry<K, V>> entryItr = entrySet.iterator();
assertEquals(e0(), entryItr.next());
Reported by PMD.
Line: 57
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySetIteratorRemove() {
Set<Entry<K, V>> entrySet = getMap().entrySet();
Iterator<Entry<K, V>> entryItr = entrySet.iterator();
assertEquals(e0(), entryItr.next());
entryItr.remove();
assertTrue(getMap().isEmpty());
Reported by PMD.
Line: 58
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySetIteratorRemove() {
Set<Entry<K, V>> entrySet = getMap().entrySet();
Iterator<Entry<K, V>> entryItr = entrySet.iterator();
assertEquals(e0(), entryItr.next());
entryItr.remove();
assertTrue(getMap().isEmpty());
assertFalse(entrySet.contains(e0()));
Reported by PMD.
Line: 59
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySetIteratorRemove() {
Set<Entry<K, V>> entrySet = getMap().entrySet();
Iterator<Entry<K, V>> entryItr = entrySet.iterator();
assertEquals(e0(), entryItr.next());
entryItr.remove();
assertTrue(getMap().isEmpty());
assertFalse(entrySet.contains(e0()));
}
Reported by PMD.
Line: 62
Iterator<Entry<K, V>> entryItr = entrySet.iterator();
assertEquals(e0(), entryItr.next());
entryItr.remove();
assertTrue(getMap().isEmpty());
assertFalse(entrySet.contains(e0()));
}
public void testContainsEntryWithIncomparableKey() {
try {
Reported by PMD.
Line: 63
assertEquals(e0(), entryItr.next());
entryItr.remove();
assertTrue(getMap().isEmpty());
assertFalse(entrySet.contains(e0()));
}
public void testContainsEntryWithIncomparableKey() {
try {
assertFalse(getMap().entrySet().contains(Helpers.mapEntry(IncomparableType.INSTANCE, v0())));
Reported by PMD.
Line: 66
assertFalse(entrySet.contains(e0()));
}
public void testContainsEntryWithIncomparableKey() {
try {
assertFalse(getMap().entrySet().contains(Helpers.mapEntry(IncomparableType.INSTANCE, v0())));
} catch (ClassCastException acceptable) {
// allowed by the spec
}
Reported by PMD.
Line: 68
public void testContainsEntryWithIncomparableKey() {
try {
assertFalse(getMap().entrySet().contains(Helpers.mapEntry(IncomparableType.INSTANCE, v0())));
} catch (ClassCastException acceptable) {
// allowed by the spec
}
}
Reported by PMD.
Line: 68
public void testContainsEntryWithIncomparableKey() {
try {
assertFalse(getMap().entrySet().contains(Helpers.mapEntry(IncomparableType.INSTANCE, v0())));
} catch (ClassCastException acceptable) {
// allowed by the spec
}
}
Reported by PMD.
Line: 69
public void testContainsEntryWithIncomparableKey() {
try {
assertFalse(getMap().entrySet().contains(Helpers.mapEntry(IncomparableType.INSTANCE, v0())));
} catch (ClassCastException acceptable) {
// allowed by the spec
}
}
public void testContainsEntryWithIncomparableValue() {
Reported by PMD.
guava-tests/test/com/google/common/collect/FilteredMultimapTest.java
36 issues
Line: 37
new Predicate<Entry<String, Integer>>() {
@Override
public boolean apply(Entry<String, Integer> entry) {
return !"badkey".equals(entry.getKey()) && !((Integer) 55556).equals(entry.getValue());
}
};
protected Multimap<String, Integer> create() {
Multimap<String, Integer> unfiltered = HashMultimap.create();
Reported by PMD.
Line: 43
protected Multimap<String, Integer> create() {
Multimap<String, Integer> unfiltered = HashMultimap.create();
unfiltered.put("foo", 55556);
unfiltered.put("badkey", 1);
return Multimaps.filterEntries(unfiltered, ENTRY_PREDICATE);
}
private static final Predicate<String> KEY_PREDICATE =
Reported by PMD.
Line: 43
protected Multimap<String, Integer> create() {
Multimap<String, Integer> unfiltered = HashMultimap.create();
unfiltered.put("foo", 55556);
unfiltered.put("badkey", 1);
return Multimaps.filterEntries(unfiltered, ENTRY_PREDICATE);
}
private static final Predicate<String> KEY_PREDICATE =
Reported by PMD.
Line: 44
protected Multimap<String, Integer> create() {
Multimap<String, Integer> unfiltered = HashMultimap.create();
unfiltered.put("foo", 55556);
unfiltered.put("badkey", 1);
return Multimaps.filterEntries(unfiltered, ENTRY_PREDICATE);
}
private static final Predicate<String> KEY_PREDICATE =
new Predicate<String>() {
Reported by PMD.
Line: 56
}
};
public void testFilterKeys() {
Multimap<String, Integer> unfiltered = HashMultimap.create();
unfiltered.put("foo", 55556);
unfiltered.put("badkey", 1);
Multimap<String, Integer> filtered = Multimaps.filterKeys(unfiltered, KEY_PREDICATE);
assertEquals(1, filtered.size());
Reported by PMD.
Line: 56
}
};
public void testFilterKeys() {
Multimap<String, Integer> unfiltered = HashMultimap.create();
unfiltered.put("foo", 55556);
unfiltered.put("badkey", 1);
Multimap<String, Integer> filtered = Multimaps.filterKeys(unfiltered, KEY_PREDICATE);
assertEquals(1, filtered.size());
Reported by PMD.
Line: 58
public void testFilterKeys() {
Multimap<String, Integer> unfiltered = HashMultimap.create();
unfiltered.put("foo", 55556);
unfiltered.put("badkey", 1);
Multimap<String, Integer> filtered = Multimaps.filterKeys(unfiltered, KEY_PREDICATE);
assertEquals(1, filtered.size());
assertTrue(filtered.containsEntry("foo", 55556));
}
Reported by PMD.
Line: 59
public void testFilterKeys() {
Multimap<String, Integer> unfiltered = HashMultimap.create();
unfiltered.put("foo", 55556);
unfiltered.put("badkey", 1);
Multimap<String, Integer> filtered = Multimaps.filterKeys(unfiltered, KEY_PREDICATE);
assertEquals(1, filtered.size());
assertTrue(filtered.containsEntry("foo", 55556));
}
Reported by PMD.
Line: 61
unfiltered.put("foo", 55556);
unfiltered.put("badkey", 1);
Multimap<String, Integer> filtered = Multimaps.filterKeys(unfiltered, KEY_PREDICATE);
assertEquals(1, filtered.size());
assertTrue(filtered.containsEntry("foo", 55556));
}
private static final Predicate<Integer> VALUE_PREDICATE =
new Predicate<Integer>() {
Reported by PMD.
Line: 61
unfiltered.put("foo", 55556);
unfiltered.put("badkey", 1);
Multimap<String, Integer> filtered = Multimaps.filterKeys(unfiltered, KEY_PREDICATE);
assertEquals(1, filtered.size());
assertTrue(filtered.containsEntry("foo", 55556));
}
private static final Predicate<Integer> VALUE_PREDICATE =
new Predicate<Integer>() {
Reported by PMD.
guava-testlib/test/com/google/common/collect/testing/MinimalIterableTest.java
36 issues
Line: 33
@GwtCompatible
public class MinimalIterableTest extends TestCase {
public void testOf_empty() {
Iterable<String> iterable = MinimalIterable.<String>of();
Iterator<String> iterator = iterable.iterator();
assertFalse(iterator.hasNext());
try {
iterator.next();
Reported by PMD.
Line: 35
public void testOf_empty() {
Iterable<String> iterable = MinimalIterable.<String>of();
Iterator<String> iterator = iterable.iterator();
assertFalse(iterator.hasNext());
try {
iterator.next();
fail();
} catch (NoSuchElementException expected) {
Reported by PMD.
Line: 36
public void testOf_empty() {
Iterable<String> iterable = MinimalIterable.<String>of();
Iterator<String> iterator = iterable.iterator();
assertFalse(iterator.hasNext());
try {
iterator.next();
fail();
} catch (NoSuchElementException expected) {
}
Reported by PMD.
Line: 39
assertFalse(iterator.hasNext());
try {
iterator.next();
fail();
} catch (NoSuchElementException expected) {
}
try {
iterable.iterator();
fail();
Reported by PMD.
Line: 39
assertFalse(iterator.hasNext());
try {
iterator.next();
fail();
} catch (NoSuchElementException expected) {
}
try {
iterable.iterator();
fail();
Reported by PMD.
Line: 44
}
try {
iterable.iterator();
fail();
} catch (IllegalStateException expected) {
}
}
public void testOf_one() {
Reported by PMD.
Line: 44
}
try {
iterable.iterator();
fail();
} catch (IllegalStateException expected) {
}
}
public void testOf_one() {
Reported by PMD.
Line: 49
}
}
public void testOf_one() {
Iterable<String> iterable = MinimalIterable.of("a");
Iterator<String> iterator = iterable.iterator();
assertTrue(iterator.hasNext());
assertEquals("a", iterator.next());
assertFalse(iterator.hasNext());
Reported by PMD.
Line: 49
}
}
public void testOf_one() {
Iterable<String> iterable = MinimalIterable.of("a");
Iterator<String> iterator = iterable.iterator();
assertTrue(iterator.hasNext());
assertEquals("a", iterator.next());
assertFalse(iterator.hasNext());
Reported by PMD.
Line: 51
public void testOf_one() {
Iterable<String> iterable = MinimalIterable.of("a");
Iterator<String> iterator = iterable.iterator();
assertTrue(iterator.hasNext());
assertEquals("a", iterator.next());
assertFalse(iterator.hasNext());
try {
iterator.next();
Reported by PMD.