The following issues were found
android/guava-tests/test/com/google/common/util/concurrent/FakeTimeLimiterTest.java
16 issues
Line: 36
private static final int DELAY_MS = 50;
private static final String RETURN_VALUE = "abc";
private TimeLimiter timeLimiter;
@Override
protected void setUp() throws Exception {
super.setUp();
timeLimiter = new FakeTimeLimiter();
Reported by PMD.
Line: 38
private TimeLimiter timeLimiter;
@Override
protected void setUp() throws Exception {
super.setUp();
timeLimiter = new FakeTimeLimiter();
}
Reported by PMD.
Line: 44
timeLimiter = new FakeTimeLimiter();
}
public void testCallWithTimeout_propagatesReturnValue() throws Exception {
String result =
timeLimiter.callWithTimeout(
Callables.returning(RETURN_VALUE), DELAY_MS, TimeUnit.MILLISECONDS);
assertThat(result).isEqualTo(RETURN_VALUE);
Reported by PMD.
Line: 49
timeLimiter.callWithTimeout(
Callables.returning(RETURN_VALUE), DELAY_MS, TimeUnit.MILLISECONDS);
assertThat(result).isEqualTo(RETURN_VALUE);
}
public void testCallWithTimeout_wrapsCheckedException() throws Exception {
Exception exception = new SampleCheckedException();
try {
Reported by PMD.
Line: 52
assertThat(result).isEqualTo(RETURN_VALUE);
}
public void testCallWithTimeout_wrapsCheckedException() throws Exception {
Exception exception = new SampleCheckedException();
try {
timeLimiter.callWithTimeout(callableThrowing(exception), DELAY_MS, TimeUnit.MILLISECONDS);
fail("Expected ExecutionException");
} catch (ExecutionException e) {
Reported by PMD.
Line: 58
timeLimiter.callWithTimeout(callableThrowing(exception), DELAY_MS, TimeUnit.MILLISECONDS);
fail("Expected ExecutionException");
} catch (ExecutionException e) {
assertThat(e.getCause()).isEqualTo(exception);
}
}
public void testCallWithTimeout_wrapsUncheckedException() throws Exception {
Exception exception = new RuntimeException("test");
Reported by PMD.
Line: 62
}
}
public void testCallWithTimeout_wrapsUncheckedException() throws Exception {
Exception exception = new RuntimeException("test");
try {
timeLimiter.callWithTimeout(callableThrowing(exception), DELAY_MS, TimeUnit.MILLISECONDS);
fail("Expected UncheckedExecutionException");
} catch (UncheckedExecutionException e) {
Reported by PMD.
Line: 68
timeLimiter.callWithTimeout(callableThrowing(exception), DELAY_MS, TimeUnit.MILLISECONDS);
fail("Expected UncheckedExecutionException");
} catch (UncheckedExecutionException e) {
assertThat(e.getCause()).isEqualTo(exception);
}
}
public void testCallUninterruptiblyWithTimeout_propagatesReturnValue() throws Exception {
String result =
Reported by PMD.
Line: 72
}
}
public void testCallUninterruptiblyWithTimeout_propagatesReturnValue() throws Exception {
String result =
timeLimiter.callUninterruptiblyWithTimeout(
Callables.returning(RETURN_VALUE), DELAY_MS, TimeUnit.MILLISECONDS);
assertThat(result).isEqualTo(RETURN_VALUE);
Reported by PMD.
Line: 77
timeLimiter.callUninterruptiblyWithTimeout(
Callables.returning(RETURN_VALUE), DELAY_MS, TimeUnit.MILLISECONDS);
assertThat(result).isEqualTo(RETURN_VALUE);
}
public void testRunWithTimeout_returnsWithoutException() throws Exception {
timeLimiter.runWithTimeout(Runnables.doNothing(), DELAY_MS, TimeUnit.MILLISECONDS);
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java
16 issues
Line: 42
@Override
protected void assertGet(K key, Collection<V> values) {
assertEqualInOrder(values, multimap().get(key));
if (!values.isEmpty()) {
assertEqualInOrder(values, multimap().asMap().get(key));
assertFalse(multimap().isEmpty());
} else {
Reported by PMD.
Line: 45
assertEqualInOrder(values, multimap().get(key));
if (!values.isEmpty()) {
assertEqualInOrder(values, multimap().asMap().get(key));
assertFalse(multimap().isEmpty());
} else {
assertNull(multimap().asMap().get(key));
}
Reported by PMD.
Line: 45
assertEqualInOrder(values, multimap().get(key));
if (!values.isEmpty()) {
assertEqualInOrder(values, multimap().asMap().get(key));
assertFalse(multimap().isEmpty());
} else {
assertNull(multimap().asMap().get(key));
}
Reported by PMD.
Line: 46
if (!values.isEmpty()) {
assertEqualInOrder(values, multimap().asMap().get(key));
assertFalse(multimap().isEmpty());
} else {
assertNull(multimap().asMap().get(key));
}
assertEquals(values.size(), multimap().get(key).size());
Reported by PMD.
Line: 48
assertEqualInOrder(values, multimap().asMap().get(key));
assertFalse(multimap().isEmpty());
} else {
assertNull(multimap().asMap().get(key));
}
assertEquals(values.size(), multimap().get(key).size());
assertEquals(values.size() > 0, multimap().containsKey(key));
assertEquals(values.size() > 0, multimap().keySet().contains(key));
Reported by PMD.
Line: 48
assertEqualInOrder(values, multimap().asMap().get(key));
assertFalse(multimap().isEmpty());
} else {
assertNull(multimap().asMap().get(key));
}
assertEquals(values.size(), multimap().get(key).size());
assertEquals(values.size() > 0, multimap().containsKey(key));
assertEquals(values.size() > 0, multimap().keySet().contains(key));
Reported by PMD.
Line: 51
assertNull(multimap().asMap().get(key));
}
assertEquals(values.size(), multimap().get(key).size());
assertEquals(values.size() > 0, multimap().containsKey(key));
assertEquals(values.size() > 0, multimap().keySet().contains(key));
assertEquals(values.size() > 0, multimap().keys().contains(key));
}
}
Reported by PMD.
Line: 51
assertNull(multimap().asMap().get(key));
}
assertEquals(values.size(), multimap().get(key).size());
assertEquals(values.size() > 0, multimap().containsKey(key));
assertEquals(values.size() > 0, multimap().keySet().contains(key));
assertEquals(values.size() > 0, multimap().keys().contains(key));
}
}
Reported by PMD.
Line: 52
}
assertEquals(values.size(), multimap().get(key).size());
assertEquals(values.size() > 0, multimap().containsKey(key));
assertEquals(values.size() > 0, multimap().keySet().contains(key));
assertEquals(values.size() > 0, multimap().keys().contains(key));
}
}
Reported by PMD.
Line: 52
}
assertEquals(values.size(), multimap().get(key).size());
assertEquals(values.size() > 0, multimap().containsKey(key));
assertEquals(values.size() > 0, multimap().keySet().contains(key));
assertEquals(values.size() > 0, multimap().keys().contains(key));
}
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java
16 issues
Line: 50
for (Entry<K, V> entry : expected) {
reversedEntries.add(reverseEntry(entry));
}
Helpers.assertEqualIgnoringOrder(getMap().inverse().entrySet(), reversedEntries);
for (Entry<K, V> entry : expected) {
assertEquals(
"Wrong key for value " + entry.getValue(),
entry.getKey(),
Reported by PMD.
Line: 50
for (Entry<K, V> entry : expected) {
reversedEntries.add(reverseEntry(entry));
}
Helpers.assertEqualIgnoringOrder(getMap().inverse().entrySet(), reversedEntries);
for (Entry<K, V> entry : expected) {
assertEquals(
"Wrong key for value " + entry.getValue(),
entry.getKey(),
Reported by PMD.
Line: 56
assertEquals(
"Wrong key for value " + entry.getValue(),
entry.getKey(),
getMap().inverse().get(entry.getValue()));
}
}
@Override
protected void expectMissing(Entry<K, V>... entries) {
Reported by PMD.
Line: 56
assertEquals(
"Wrong key for value " + entry.getValue(),
entry.getKey(),
getMap().inverse().get(entry.getValue()));
}
}
@Override
protected void expectMissing(Entry<K, V>... entries) {
Reported by PMD.
Line: 65
super.expectMissing(entries);
for (Entry<K, V> entry : entries) {
Entry<V, K> reversed = reverseEntry(entry);
BiMap<V, K> inv = getMap().inverse();
assertFalse(
"Inverse should not contain entry " + reversed, inv.entrySet().contains(reversed));
assertFalse(
"Inverse should not contain key " + reversed.getKey(),
inv.containsKey(reversed.getKey()));
Reported by PMD.
Line: 67
Entry<V, K> reversed = reverseEntry(entry);
BiMap<V, K> inv = getMap().inverse();
assertFalse(
"Inverse should not contain entry " + reversed, inv.entrySet().contains(reversed));
assertFalse(
"Inverse should not contain key " + reversed.getKey(),
inv.containsKey(reversed.getKey()));
assertFalse(
"Inverse should not contain value " + reversed.getValue(),
Reported by PMD.
Line: 67
Entry<V, K> reversed = reverseEntry(entry);
BiMap<V, K> inv = getMap().inverse();
assertFalse(
"Inverse should not contain entry " + reversed, inv.entrySet().contains(reversed));
assertFalse(
"Inverse should not contain key " + reversed.getKey(),
inv.containsKey(reversed.getKey()));
assertFalse(
"Inverse should not contain value " + reversed.getValue(),
Reported by PMD.
Line: 69
assertFalse(
"Inverse should not contain entry " + reversed, inv.entrySet().contains(reversed));
assertFalse(
"Inverse should not contain key " + reversed.getKey(),
inv.containsKey(reversed.getKey()));
assertFalse(
"Inverse should not contain value " + reversed.getValue(),
inv.containsValue(reversed.getValue()));
/*
Reported by PMD.
Line: 70
"Inverse should not contain entry " + reversed, inv.entrySet().contains(reversed));
assertFalse(
"Inverse should not contain key " + reversed.getKey(),
inv.containsKey(reversed.getKey()));
assertFalse(
"Inverse should not contain value " + reversed.getValue(),
inv.containsValue(reversed.getValue()));
/*
* TODO(cpovirk): This is a bit stronger than super.expectMissing(), which permits a <key,
Reported by PMD.
Line: 70
"Inverse should not contain entry " + reversed, inv.entrySet().contains(reversed));
assertFalse(
"Inverse should not contain key " + reversed.getKey(),
inv.containsKey(reversed.getKey()));
assertFalse(
"Inverse should not contain value " + reversed.getValue(),
inv.containsValue(reversed.getValue()));
/*
* TODO(cpovirk): This is a bit stronger than super.expectMissing(), which permits a <key,
Reported by PMD.
android/guava/src/com/google/common/collect/ContiguousSet.java
16 issues
Line: 54
@GwtCompatible(emulated = true)
@SuppressWarnings("rawtypes") // allow ungenerified Comparable types
@ElementTypesAreNonnullByDefault
public abstract class ContiguousSet<C extends Comparable> extends ImmutableSortedSet<C> {
/**
* Returns a {@code ContiguousSet} containing the same values in the given domain {@linkplain
* Range#contains contained} by the range.
*
* @throws IllegalArgumentException if neither range nor the domain has a lower bound, or if
Reported by PMD.
Line: 54
@GwtCompatible(emulated = true)
@SuppressWarnings("rawtypes") // allow ungenerified Comparable types
@ElementTypesAreNonnullByDefault
public abstract class ContiguousSet<C extends Comparable> extends ImmutableSortedSet<C> {
/**
* Returns a {@code ContiguousSet} containing the same values in the given domain {@linkplain
* Range#contains contained} by the range.
*
* @throws IllegalArgumentException if neither range nor the domain has a lower bound, or if
Reported by PMD.
Line: 80
}
boolean empty;
if (effectiveRange.isEmpty()) {
empty = true;
} else {
/*
* requireNonNull is safe because the effectiveRange operations above would have thrown or
* effectiveRange.isEmpty() would have returned true.
Reported by PMD.
Line: 87
* requireNonNull is safe because the effectiveRange operations above would have thrown or
* effectiveRange.isEmpty() would have returned true.
*/
C afterLower = requireNonNull(range.lowerBound.leastValueAbove(domain));
C beforeUpper = requireNonNull(range.upperBound.greatestValueBelow(domain));
// Per class spec, we are allowed to throw CCE if necessary
empty = Range.compareOrThrow(afterLower, beforeUpper) > 0;
}
Reported by PMD.
Line: 88
* effectiveRange.isEmpty() would have returned true.
*/
C afterLower = requireNonNull(range.lowerBound.leastValueAbove(domain));
C beforeUpper = requireNonNull(range.upperBound.greatestValueBelow(domain));
// Per class spec, we are allowed to throw CCE if necessary
empty = Range.compareOrThrow(afterLower, beforeUpper) > 0;
}
return empty
Reported by PMD.
Line: 150
return create(Range.closedOpen(lower, upper), DiscreteDomain.longs());
}
final DiscreteDomain<C> domain;
ContiguousSet(DiscreteDomain<C> domain) {
super(Ordering.natural());
this.domain = domain;
}
Reported by PMD.
Line: 173
public ContiguousSet<C> subSet(C fromElement, C toElement) {
checkNotNull(fromElement);
checkNotNull(toElement);
checkArgument(comparator().compare(fromElement, toElement) <= 0);
return subSetImpl(fromElement, true, toElement, false);
}
/** @since 12.0 */
@GwtIncompatible // NavigableSet
Reported by PMD.
Line: 184
C fromElement, boolean fromInclusive, C toElement, boolean toInclusive) {
checkNotNull(fromElement);
checkNotNull(toElement);
checkArgument(comparator().compare(fromElement, toElement) <= 0);
return subSetImpl(fromElement, fromInclusive, toElement, toInclusive);
}
@Override
public ContiguousSet<C> tailSet(C fromElement) {
Reported by PMD.
Line: 204
* These methods perform most headSet, subSet, and tailSet logic, besides parameter validation.
*/
@SuppressWarnings("MissingOverride") // Supermethod does not exist under GWT.
abstract ContiguousSet<C> headSetImpl(C toElement, boolean inclusive);
@SuppressWarnings("MissingOverride") // Supermethod does not exist under GWT.
abstract ContiguousSet<C> subSetImpl(
C fromElement, boolean fromInclusive, C toElement, boolean toInclusive);
Reported by PMD.
Line: 207
abstract ContiguousSet<C> headSetImpl(C toElement, boolean inclusive);
@SuppressWarnings("MissingOverride") // Supermethod does not exist under GWT.
abstract ContiguousSet<C> subSetImpl(
C fromElement, boolean fromInclusive, C toElement, boolean toInclusive);
@SuppressWarnings("MissingOverride") // Supermethod does not exist under GWT.
abstract ContiguousSet<C> tailSetImpl(C fromElement, boolean inclusive);
Reported by PMD.
android/guava/src/com/google/common/collect/ForwardingBlockingDeque.java
16 issues
Line: 52
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class ForwardingBlockingDeque<E> extends ForwardingDeque<E>
implements BlockingDeque<E> {
/** Constructor for use by subclasses. */
protected ForwardingBlockingDeque() {}
@Override
Reported by PMD.
Line: 62
@Override
public int remainingCapacity() {
return delegate().remainingCapacity();
}
@Override
public void putFirst(E e) throws InterruptedException {
delegate().putFirst(e);
Reported by PMD.
Line: 67
@Override
public void putFirst(E e) throws InterruptedException {
delegate().putFirst(e);
}
@Override
public void putLast(E e) throws InterruptedException {
delegate().putLast(e);
Reported by PMD.
Line: 72
@Override
public void putLast(E e) throws InterruptedException {
delegate().putLast(e);
}
@Override
public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate().offerFirst(e, timeout, unit);
Reported by PMD.
Line: 77
@Override
public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate().offerFirst(e, timeout, unit);
}
@Override
public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate().offerLast(e, timeout, unit);
Reported by PMD.
Line: 82
@Override
public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate().offerLast(e, timeout, unit);
}
@Override
public E takeFirst() throws InterruptedException {
return delegate().takeFirst();
Reported by PMD.
Line: 87
@Override
public E takeFirst() throws InterruptedException {
return delegate().takeFirst();
}
@Override
public E takeLast() throws InterruptedException {
return delegate().takeLast();
Reported by PMD.
Line: 92
@Override
public E takeLast() throws InterruptedException {
return delegate().takeLast();
}
@Override
@CheckForNull
public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException {
Reported by PMD.
Line: 98
@Override
@CheckForNull
public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException {
return delegate().pollFirst(timeout, unit);
}
@Override
@CheckForNull
public E pollLast(long timeout, TimeUnit unit) throws InterruptedException {
Reported by PMD.
Line: 104
@Override
@CheckForNull
public E pollLast(long timeout, TimeUnit unit) throws InterruptedException {
return delegate().pollLast(timeout, unit);
}
@Override
public void put(E e) throws InterruptedException {
delegate().put(e);
Reported by PMD.
android/guava/src/com/google/common/collect/ForwardingCollection.java
16 issues
Line: 52
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class ForwardingCollection<E extends @Nullable Object> extends ForwardingObject
implements Collection<E> {
// TODO(lowasser): identify places where thread safety is actually lost
/** Constructor for use by subclasses. */
protected ForwardingCollection() {}
Reported by PMD.
Line: 63
@Override
public Iterator<E> iterator() {
return delegate().iterator();
}
@Override
public int size() {
return delegate().size();
Reported by PMD.
Line: 68
@Override
public int size() {
return delegate().size();
}
@CanIgnoreReturnValue
@Override
public boolean removeAll(Collection<?> collection) {
Reported by PMD.
Line: 74
@CanIgnoreReturnValue
@Override
public boolean removeAll(Collection<?> collection) {
return delegate().removeAll(collection);
}
@Override
public boolean isEmpty() {
return delegate().isEmpty();
Reported by PMD.
Line: 79
@Override
public boolean isEmpty() {
return delegate().isEmpty();
}
@Override
public boolean contains(@CheckForNull Object object) {
return delegate().contains(object);
Reported by PMD.
Line: 84
@Override
public boolean contains(@CheckForNull Object object) {
return delegate().contains(object);
}
@CanIgnoreReturnValue
@Override
public boolean add(@ParametricNullness E element) {
Reported by PMD.
Line: 90
@CanIgnoreReturnValue
@Override
public boolean add(@ParametricNullness E element) {
return delegate().add(element);
}
@CanIgnoreReturnValue
@Override
public boolean remove(@CheckForNull Object object) {
Reported by PMD.
Line: 96
@CanIgnoreReturnValue
@Override
public boolean remove(@CheckForNull Object object) {
return delegate().remove(object);
}
@Override
public boolean containsAll(Collection<?> collection) {
return delegate().containsAll(collection);
Reported by PMD.
Line: 101
@Override
public boolean containsAll(Collection<?> collection) {
return delegate().containsAll(collection);
}
@CanIgnoreReturnValue
@Override
public boolean addAll(Collection<? extends E> collection) {
Reported by PMD.
Line: 107
@CanIgnoreReturnValue
@Override
public boolean addAll(Collection<? extends E> collection) {
return delegate().addAll(collection);
}
@CanIgnoreReturnValue
@Override
public boolean retainAll(Collection<?> collection) {
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java
16 issues
Line: 177
isThreadScheduled = false;
}
// Log it and keep going.
logger.log(
Level.SEVERE,
"Exception while running callbacks for " + listener + " on " + executor,
e);
throw e;
}
Reported by PMD.
Line: 209
nextToRun.call(listener);
} catch (RuntimeException e) {
// Log it and keep going.
logger.log(
Level.SEVERE,
"Exception while executing callback: " + listener + " " + nextLabel,
e);
}
}
Reported by PMD.
Line: 62
private static final Logger logger = Logger.getLogger(ListenerCallQueue.class.getName());
// TODO(chrisn): promote AppendOnlyCollection for use here.
private final List<PerListenerQueue<L>> listeners =
Collections.synchronizedList(new ArrayList<PerListenerQueue<L>>());
/** Method reference-compatible listener event. */
interface Event<L> {
/** Call a method on the listener. */
Reported by PMD.
Line: 120
*/
public void dispatch() {
// iterate by index to avoid concurrent modification exceptions
for (int i = 0; i < listeners.size(); i++) {
listeners.get(i).dispatch();
}
}
/**
Reported by PMD.
Line: 121
public void dispatch() {
// iterate by index to avoid concurrent modification exceptions
for (int i = 0; i < listeners.size(); i++) {
listeners.get(i).dispatch();
}
}
/**
* A special purpose queue/executor that dispatches listener events serially on a configured
Reported by PMD.
Line: 133
* be added without necessarily executing immediately.
*/
private static final class PerListenerQueue<L> implements Runnable {
final L listener;
final Executor executor;
@GuardedBy("this")
final Queue<ListenerCallQueue.Event<L>> waitQueue = Queues.newArrayDeque();
Reported by PMD.
Line: 134
*/
private static final class PerListenerQueue<L> implements Runnable {
final L listener;
final Executor executor;
@GuardedBy("this")
final Queue<ListenerCallQueue.Event<L>> waitQueue = Queues.newArrayDeque();
@GuardedBy("this")
Reported by PMD.
Line: 137
final Executor executor;
@GuardedBy("this")
final Queue<ListenerCallQueue.Event<L>> waitQueue = Queues.newArrayDeque();
@GuardedBy("this")
final Queue<Object> labelQueue = Queues.newArrayDeque();
@GuardedBy("this")
Reported by PMD.
Line: 140
final Queue<ListenerCallQueue.Event<L>> waitQueue = Queues.newArrayDeque();
@GuardedBy("this")
final Queue<Object> labelQueue = Queues.newArrayDeque();
@GuardedBy("this")
boolean isThreadScheduled;
PerListenerQueue(L listener, Executor executor) {
Reported by PMD.
Line: 143
final Queue<Object> labelQueue = Queues.newArrayDeque();
@GuardedBy("this")
boolean isThreadScheduled;
PerListenerQueue(L listener, Executor executor) {
this.listener = checkNotNull(listener);
this.executor = checkNotNull(executor);
}
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java
16 issues
Line: 50
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class ForwardingBlockingDeque<E> extends ForwardingDeque<E>
implements BlockingDeque<E> {
/** Constructor for use by subclasses. */
protected ForwardingBlockingDeque() {}
@Override
Reported by PMD.
Line: 60
@Override
public int remainingCapacity() {
return delegate().remainingCapacity();
}
@Override
public void putFirst(E e) throws InterruptedException {
delegate().putFirst(e);
Reported by PMD.
Line: 65
@Override
public void putFirst(E e) throws InterruptedException {
delegate().putFirst(e);
}
@Override
public void putLast(E e) throws InterruptedException {
delegate().putLast(e);
Reported by PMD.
Line: 70
@Override
public void putLast(E e) throws InterruptedException {
delegate().putLast(e);
}
@Override
public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate().offerFirst(e, timeout, unit);
Reported by PMD.
Line: 75
@Override
public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate().offerFirst(e, timeout, unit);
}
@Override
public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate().offerLast(e, timeout, unit);
Reported by PMD.
Line: 80
@Override
public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException {
return delegate().offerLast(e, timeout, unit);
}
@Override
public E takeFirst() throws InterruptedException {
return delegate().takeFirst();
Reported by PMD.
Line: 85
@Override
public E takeFirst() throws InterruptedException {
return delegate().takeFirst();
}
@Override
public E takeLast() throws InterruptedException {
return delegate().takeLast();
Reported by PMD.
Line: 90
@Override
public E takeLast() throws InterruptedException {
return delegate().takeLast();
}
@Override
@CheckForNull
public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException {
Reported by PMD.
Line: 96
@Override
@CheckForNull
public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException {
return delegate().pollFirst(timeout, unit);
}
@Override
@CheckForNull
public E pollLast(long timeout, TimeUnit unit) throws InterruptedException {
Reported by PMD.
Line: 102
@Override
@CheckForNull
public E pollLast(long timeout, TimeUnit unit) throws InterruptedException {
return delegate().pollLast(timeout, unit);
}
@Override
public void put(E e) throws InterruptedException {
delegate().put(e);
Reported by PMD.
android/guava/src/com/google/common/math/StatsAccumulator.java
16 issues
Line: 38
@Beta
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class StatsAccumulator {
// These fields must satisfy the requirements of Stats' constructor as well as those of the stat
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
Reported by PMD.
Line: 42
// These fields must satisfy the requirements of Stats' constructor as well as those of the stat
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
private double sumOfSquaresOfDeltas = 0.0;
private double min = NaN; // any value will do
private double max = NaN; // any value will do
Reported by PMD.
Line: 42
// These fields must satisfy the requirements of Stats' constructor as well as those of the stat
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
private double sumOfSquaresOfDeltas = 0.0;
private double min = NaN; // any value will do
private double max = NaN; // any value will do
Reported by PMD.
Line: 42
// These fields must satisfy the requirements of Stats' constructor as well as those of the stat
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
private double sumOfSquaresOfDeltas = 0.0;
private double min = NaN; // any value will do
private double max = NaN; // any value will do
Reported by PMD.
Line: 43
// These fields must satisfy the requirements of Stats' constructor as well as those of the stat
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
private double sumOfSquaresOfDeltas = 0.0;
private double min = NaN; // any value will do
private double max = NaN; // any value will do
/** Adds the given value to the dataset. */
Reported by PMD.
Line: 43
// These fields must satisfy the requirements of Stats' constructor as well as those of the stat
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
private double sumOfSquaresOfDeltas = 0.0;
private double min = NaN; // any value will do
private double max = NaN; // any value will do
/** Adds the given value to the dataset. */
Reported by PMD.
Line: 43
// These fields must satisfy the requirements of Stats' constructor as well as those of the stat
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
private double sumOfSquaresOfDeltas = 0.0;
private double min = NaN; // any value will do
private double max = NaN; // any value will do
/** Adds the given value to the dataset. */
Reported by PMD.
Line: 44
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
private double sumOfSquaresOfDeltas = 0.0;
private double min = NaN; // any value will do
private double max = NaN; // any value will do
/** Adds the given value to the dataset. */
public void add(double value) {
Reported by PMD.
Line: 44
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
private double sumOfSquaresOfDeltas = 0.0;
private double min = NaN; // any value will do
private double max = NaN; // any value will do
/** Adds the given value to the dataset. */
public void add(double value) {
Reported by PMD.
Line: 44
// methods of this class.
private long count = 0;
private double mean = 0.0; // any finite value will do, we only use it to multiply by zero for sum
private double sumOfSquaresOfDeltas = 0.0;
private double min = NaN; // any value will do
private double max = NaN; // any value will do
/** Adds the given value to the dataset. */
public void add(double value) {
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/AbstractChainedListenableFutureTest.java
16 issues
Line: 37
protected static final int VALID_INPUT_DATA = 1;
protected static final Exception EXCEPTION = new Exception("Test exception");
protected SettableFuture<Integer> inputFuture;
protected ListenableFuture<T> resultFuture;
protected MockFutureListener listener;
@Override
protected void setUp() throws Exception {
Reported by PMD.
Line: 38
protected static final Exception EXCEPTION = new Exception("Test exception");
protected SettableFuture<Integer> inputFuture;
protected ListenableFuture<T> resultFuture;
protected MockFutureListener listener;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 39
protected SettableFuture<Integer> inputFuture;
protected ListenableFuture<T> resultFuture;
protected MockFutureListener listener;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 41
protected ListenableFuture<T> resultFuture;
protected MockFutureListener listener;
@Override
protected void setUp() throws Exception {
super.setUp();
inputFuture = SettableFuture.create();
resultFuture = buildChainingFuture(inputFuture);
Reported by PMD.
Line: 50
listener = new MockFutureListener(resultFuture);
}
public void testFutureGetBeforeCallback() throws Exception {
// Verify that get throws a timeout exception before the callback is called.
try {
resultFuture.get(1L, TimeUnit.MILLISECONDS);
fail("The data is not yet ready, so a TimeoutException is expected");
} catch (TimeoutException expected) {
Reported by PMD.
Line: 54
// Verify that get throws a timeout exception before the callback is called.
try {
resultFuture.get(1L, TimeUnit.MILLISECONDS);
fail("The data is not yet ready, so a TimeoutException is expected");
} catch (TimeoutException expected) {
}
}
public void testFutureGetThrowsWrappedException() throws Exception {
Reported by PMD.
Line: 59
}
}
public void testFutureGetThrowsWrappedException() throws Exception {
inputFuture.setException(EXCEPTION);
listener.assertException(EXCEPTION);
}
public void testFutureGetThrowsWrappedError() throws Exception {
Reported by PMD.
Line: 59
}
}
public void testFutureGetThrowsWrappedException() throws Exception {
inputFuture.setException(EXCEPTION);
listener.assertException(EXCEPTION);
}
public void testFutureGetThrowsWrappedError() throws Exception {
Reported by PMD.
Line: 64
listener.assertException(EXCEPTION);
}
public void testFutureGetThrowsWrappedError() throws Exception {
Error error = new Error();
inputFuture.setException(error);
// Verify that get throws an ExecutionException, caused by an Error, when
// the callback is called.
listener.assertException(error);
Reported by PMD.
Line: 64
listener.assertException(EXCEPTION);
}
public void testFutureGetThrowsWrappedError() throws Exception {
Error error = new Error();
inputFuture.setException(error);
// Verify that get throws an ExecutionException, caused by an Error, when
// the callback is called.
listener.assertException(error);
Reported by PMD.