<propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <configuration>
+ <failOnError>true</failOnError>
+ </configuration>
+ </plugin>
</plugins>
</build>
import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.ArrayList;
private HashMap<K, V> newKeys;
private Object[] objects;
private int removed = 0;
+
+ // Fail-fast iterator guard, see java.util.ArrayList for reference.
+ @SuppressFBWarnings("VO_VOLATILE_INCREMENT")
private transient volatile int modCount;
private boolean needClone = true;
private void cloneArray() {
if (needClone) {
needClone = false;
- if (!EMPTY_ARRAY.equals(objects)) {
+ if (objects.length != 0) {
objects = objects.clone();
}
}
private final Executor listenerExecutor;
private DelegatingAsyncNotifyingListenableFutureTask(final Callable<V> callable,
- @Nullable final Executor listenerExecutor) {
+ final Executor listenerExecutor) {
super(callable);
this.listenerExecutor = requireNonNull(listenerExecutor);
}
private DelegatingAsyncNotifyingListenableFutureTask(final Runnable runnable, @Nullable final V result,
- @Nullable final Executor listenerExecutor) {
+ final Executor listenerExecutor) {
super(runnable, result);
this.listenerExecutor = requireNonNull(listenerExecutor);
}
super(callable);
}
- private AsyncNotifyingListenableFutureTask(final Runnable runnable, @Nullable final V result) {
+ private AsyncNotifyingListenableFutureTask(final Runnable runnable, final V result) {
super(runnable, result);
}
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
}
public long getLargestQueueSize() {
- return ((TrackingLinkedBlockingQueue<?>)executorQueue.getBackingQueue()).getLargestQueueSize();
+ return executorQueue.getBackingQueue().getLargestQueueSize();
}
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
private static final long POLL_WAIT_TIME_IN_MS = 300;
- private final LinkedBlockingQueue<Runnable> backingQueue;
+ @SuppressFBWarnings("SE_BAD_FIELD") // Runnable is not Serializable
+ private final TrackingLinkedBlockingQueue<Runnable> backingQueue;
ExecutorQueue(final int maxBackingQueueSize) {
backingQueue = new TrackingLinkedBlockingQueue<>(maxBackingQueueSize);
}
- LinkedBlockingQueue<Runnable> getBackingQueue() {
+ TrackingLinkedBlockingQueue<Runnable> getBackingQueue() {
return backingQueue;
}
import static java.util.Objects.requireNonNull;
import com.google.common.base.Function;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
*/
protected abstract X newWithCause(String message, Throwable cause);
- @SuppressWarnings("unchecked")
@Override
+ @SuppressWarnings("unchecked")
+ @SuppressFBWarnings({"BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"})
public X apply(final Exception input) {
// If exception is of the specified type,return it.
NotificationTask(final ListenerKey<L> listenerKey, final Iterator<N> notifications) {
this.listenerKey = requireNonNull(listenerKey);
while (notifications.hasNext()) {
- queue.offer(notifications.next());
+ queue.add(notifications.next());
}
}
return true;
}
- queue.offer(notifications.next());
+ queue.add(notifications.next());
}
}
} finally {