The following issues were found
guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java
3 issues
Line: 47
@Override
public void addListener(Runnable listener, Executor exec) {
delegate().addListener(listener, exec);
}
// TODO(cpovirk): Use standard Javadoc form for SimpleForwarding* class and constructor
/**
* A simplified version of {@link ForwardingListenableFuture} where subclasses can pass in an
Reported by PMD.
Line: 59
*/
public abstract static class SimpleForwardingListenableFuture<V extends @Nullable Object>
extends ForwardingListenableFuture<V> {
private final ListenableFuture<V> delegate;
protected SimpleForwardingListenableFuture(ListenableFuture<V> delegate) {
this.delegate = Preconditions.checkNotNull(delegate);
}
Reported by PMD.
Line: 59
*/
public abstract static class SimpleForwardingListenableFuture<V extends @Nullable Object>
extends ForwardingListenableFuture<V> {
private final ListenableFuture<V> delegate;
protected SimpleForwardingListenableFuture(ListenableFuture<V> delegate) {
this.delegate = Preconditions.checkNotNull(delegate);
}
Reported by PMD.
guava/src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java
3 issues
Line: 44
@Override
public <T extends @Nullable Object> ListenableFuture<T> submit(Callable<T> task) {
return delegate().submit(task);
}
@Override
public ListenableFuture<?> submit(Runnable task) {
return delegate().submit(task);
Reported by PMD.
Line: 49
@Override
public ListenableFuture<?> submit(Runnable task) {
return delegate().submit(task);
}
@Override
public <T extends @Nullable Object> ListenableFuture<T> submit(
Runnable task, @ParametricNullness T result) {
Reported by PMD.
Line: 55
@Override
public <T extends @Nullable Object> ListenableFuture<T> submit(
Runnable task, @ParametricNullness T result) {
return delegate().submit(task, result);
}
}
Reported by PMD.
guava/src/com/google/common/util/concurrent/ImmediateFuture.java
3 issues
Line: 52
} catch (RuntimeException e) {
// ListenableFuture's contract is that it will not throw unchecked exceptions, so log the bad
// runnable and/or executor and swallow it.
log.log(
Level.SEVERE,
"RuntimeException while executing runnable " + listener + " with executor " + executor,
e);
}
}
Reported by PMD.
Line: 37
private static final Logger log = Logger.getLogger(ImmediateFuture.class.getName());
@ParametricNullness private final V value;
ImmediateFuture(@ParametricNullness V value) {
this.value = value;
}
Reported by PMD.
Line: 49
checkNotNull(executor, "Executor was null.");
try {
executor.execute(listener);
} catch (RuntimeException e) {
// ListenableFuture's contract is that it will not throw unchecked exceptions, so log the bad
// runnable and/or executor and swallow it.
log.log(
Level.SEVERE,
"RuntimeException while executing runnable " + listener + " with executor " + executor,
Reported by PMD.
guava/src/com/google/common/util/concurrent/RateLimiter.java
3 issues
Line: 98
@Beta
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class RateLimiter {
/**
* Creates a {@code RateLimiter} with the specified stable throughput, given as "permits per
* second" (commonly referred to as <i>QPS</i>, queries per second).
*
* <p>The returned {@code RateLimiter} ensures that on average no more than {@code
Reported by PMD.
Line: 215
* The underlying timer; used both to measure elapsed time and sleep as necessary. A separate
* object to facilitate testing.
*/
private final SleepingStopwatch stopwatch;
// Can't be initialized in the constructor because mocks don't call the constructor.
@CheckForNull private volatile Object mutexDoNotUseDirectly;
private Object mutex() {
Reported by PMD.
Line: 218
private final SleepingStopwatch stopwatch;
// Can't be initialized in the constructor because mocks don't call the constructor.
@CheckForNull private volatile Object mutexDoNotUseDirectly;
private Object mutex() {
Object mutex = mutexDoNotUseDirectly;
if (mutex == null) {
synchronized (this) {
Reported by PMD.
guava/src/com/google/common/collect/RegularImmutableAsList.java
2 issues
Line: 36
@ElementTypesAreNonnullByDefault
class RegularImmutableAsList<E> extends ImmutableAsList<E> {
private final ImmutableCollection<E> delegate;
private final ImmutableList<? extends E> delegateList;
RegularImmutableAsList(ImmutableCollection<E> delegate, ImmutableList<? extends E> delegateList) {
this.delegate = delegate;
this.delegateList = delegateList;
}
Reported by PMD.
Line: 43
this.delegateList = delegateList;
}
RegularImmutableAsList(ImmutableCollection<E> delegate, Object[] array) {
this(delegate, ImmutableList.<E>asImmutableList(array));
}
@Override
ImmutableCollection<E> delegateCollection() {
Reported by PMD.
guava/src/com/google/common/collect/Count.java
2 issues
Line: 28
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
final class Count implements Serializable {
private int value;
Count(int value) {
this.value = value;
}
Reported by PMD.
Line: 29
@GwtCompatible
@ElementTypesAreNonnullByDefault
final class Count implements Serializable {
private int value;
Count(int value) {
this.value = value;
}
Reported by PMD.
guava/src/com/google/common/collect/HashBasedTable.java
2 issues
Line: 53
@ElementTypesAreNonnullByDefault
public class HashBasedTable<R, C, V> extends StandardTable<R, C, V> {
private static class Factory<C, V> implements Supplier<Map<C, V>>, Serializable {
final int expectedSize;
Factory(int expectedSize) {
this.expectedSize = expectedSize;
}
Reported by PMD.
Line: 97
public static <R, C, V> HashBasedTable<R, C, V> create(
Table<? extends R, ? extends C, ? extends V> table) {
HashBasedTable<R, C, V> result = create();
result.putAll(table);
return result;
}
HashBasedTable(Map<R, Map<C, V>> backingMap, Factory<C, V> factory) {
super(backingMap, factory);
Reported by PMD.
guava/src/com/google/common/collect/JdkBackedImmutableMap.java
2 issues
Line: 35
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
final class JdkBackedImmutableMap<K, V> extends ImmutableMap<K, V> {
/**
* Creates an {@code ImmutableMap} backed by a JDK HashMap. Used when probable hash flooding is
* detected. This implementation may replace the entries in entryArray with its own entry objects
* (though they will have the same key/value contents), and will take ownership of entryArray.
*/
Reported by PMD.
Line: 41
* detected. This implementation may replace the entries in entryArray with its own entry objects
* (though they will have the same key/value contents), and will take ownership of entryArray.
*/
static <K, V> ImmutableMap<K, V> create(int n, @Nullable Entry<K, V>[] entryArray) {
Map<K, V> delegateMap = Maps.newHashMapWithExpectedSize(n);
for (int i = 0; i < n; i++) {
// requireNonNull is safe because the first `n` elements have been filled in.
entryArray[i] = makeImmutable(requireNonNull(entryArray[i]));
V oldValue = delegateMap.putIfAbsent(entryArray[i].getKey(), entryArray[i].getValue());
Reported by PMD.
guava/src/com/google/common/collect/ArrayListMultimap.java
2 issues
Line: 148
*/
@Deprecated
public void trimToSize() {
for (Collection<V> collection : backingMap().values()) {
ArrayList<V> arrayList = (ArrayList<V>) collection;
arrayList.trimToSize();
}
}
Reported by PMD.
Line: 150
public void trimToSize() {
for (Collection<V> collection : backingMap().values()) {
ArrayList<V> arrayList = (ArrayList<V>) collection;
arrayList.trimToSize();
}
}
/**
* @serialData expectedValuesPerKey, number of distinct keys, and then for each distinct key: the
Reported by PMD.
guava/src/com/google/common/hash/PrimitiveSink.java
2 issues
Line: 73
PrimitiveSink putBytes(ByteBuffer bytes);
/** Puts a short into this sink. */
PrimitiveSink putShort(short s);
/** Puts an int into this sink. */
PrimitiveSink putInt(int i);
/** Puts a long into this sink. */
Reported by PMD.
Line: 31
@Beta
@CanIgnoreReturnValue
@ElementTypesAreNonnullByDefault
public interface PrimitiveSink {
/**
* Puts a byte into this sink.
*
* @param b a byte
* @return this instance
Reported by PMD.