The following issues were found
guava/src/com/google/common/base/FunctionalEquivalence.java
2 issues
Line: 37
private static final long serialVersionUID = 0;
private final Function<? super F, ? extends T> function;
private final Equivalence<T> resultEquivalence;
FunctionalEquivalence(
Function<? super F, ? extends T> function, Equivalence<T> resultEquivalence) {
this.function = checkNotNull(function);
Reported by PMD.
Line: 38
private static final long serialVersionUID = 0;
private final Function<? super F, ? extends T> function;
private final Equivalence<T> resultEquivalence;
FunctionalEquivalence(
Function<? super F, ? extends T> function, Equivalence<T> resultEquivalence) {
this.function = checkNotNull(function);
this.resultEquivalence = checkNotNull(resultEquivalence);
Reported by PMD.
guava/src/com/google/common/collect/NaturalOrdering.java
2 issues
Line: 33
final class NaturalOrdering extends Ordering<Comparable<?>> implements Serializable {
static final NaturalOrdering INSTANCE = new NaturalOrdering();
@CheckForNull private transient Ordering<@Nullable Comparable<?>> nullsFirst;
@CheckForNull private transient Ordering<@Nullable Comparable<?>> nullsLast;
@Override
public int compare(Comparable<?> left, Comparable<?> right) {
checkNotNull(left); // for GWT
Reported by PMD.
Line: 34
static final NaturalOrdering INSTANCE = new NaturalOrdering();
@CheckForNull private transient Ordering<@Nullable Comparable<?>> nullsFirst;
@CheckForNull private transient Ordering<@Nullable Comparable<?>> nullsLast;
@Override
public int compare(Comparable<?> left, Comparable<?> right) {
checkNotNull(left); // for GWT
checkNotNull(right);
Reported by PMD.
guava/src/com/google/common/collect/SortedLists.java
2 issues
Line: 271
* otherwise the index determined by the {@code KeyAbsentBehavior}.
*/
public static <E extends @Nullable Object> int binarySearch(
List<? extends E> list,
@ParametricNullness E key,
Comparator<? super E> comparator,
KeyPresentBehavior presentBehavior,
KeyAbsentBehavior absentBehavior) {
checkNotNull(comparator);
Reported by PMD.
Line: 286
// TODO(lowasser): benchmark when it's best to do a linear search
int lower = 0;
int upper = list.size() - 1;
while (lower <= upper) {
int middle = (lower + upper) >>> 1;
int c = comparator.compare(key, list.get(middle));
if (c < 0) {
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/RunnablesTest.java
2 issues
Line: 29
*/
@GwtCompatible
public class RunnablesTest extends TestCase {
public void testDoNothingRunnableIsSingleton() {
assertSame(Runnables.doNothing(), Runnables.doNothing());
}
}
Reported by PMD.
Line: 30
@GwtCompatible
public class RunnablesTest extends TestCase {
public void testDoNothingRunnableIsSingleton() {
assertSame(Runnables.doNothing(), Runnables.doNothing());
}
}
Reported by PMD.
guava/src/com/google/common/primitives/ShortsMethodsForWeb.java
2 issues
Line: 25
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ShortsMethodsForWeb {}
Reported by PMD.
Line: 25
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ShortsMethodsForWeb {}
Reported by PMD.
guava/src/com/google/common/collect/AbstractSortedSetMultimap.java
2 issues
Line: 135
* SortedSet} values.
*/
@Override
public Map<K, Collection<V>> asMap() {
return super.asMap();
}
/**
* {@inheritDoc}
Reported by PMD.
Line: 146
* comparator.
*/
@Override
public Collection<V> values() {
return super.values();
}
private static final long serialVersionUID = 430848587173315748L;
}
Reported by PMD.
guava/src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java
2 issues
Line: 27
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class GwtFuturesCatchingSpecialization {
/*
* This server copy of the class is empty. The corresponding GWT copy contains alternative
* versions of catching() and catchingAsync() with slightly different signatures from the ones
* found in Futures.java.
*/
Reported by PMD.
Line: 27
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class GwtFuturesCatchingSpecialization {
/*
* This server copy of the class is empty. The corresponding GWT copy contains alternative
* versions of catching() and catchingAsync() with slightly different signatures from the ones
* found in Futures.java.
*/
Reported by PMD.
guava/src/com/google/common/collect/Multimap.java
2 issues
Line: 166
@DoNotMock("Use ImmutableMultimap, HashMultimap, or another implementation")
@GwtCompatible
@ElementTypesAreNonnullByDefault
public interface Multimap<K extends @Nullable Object, V extends @Nullable Object> {
// Query Operations
/**
* Returns the number of key-value pairs in this multimap.
*
Reported by PMD.
Line: 346
*/
default void forEach(BiConsumer<? super K, ? super V> action) {
checkNotNull(action);
entries().forEach(entry -> action.accept(entry.getKey(), entry.getValue()));
}
/**
* Returns a view of this multimap as a {@code Map} from each distinct key to the nonempty
* collection of that key's associated values. Note that {@code this.asMap().get(k)} is equivalent
Reported by PMD.
guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java
2 issues
Line: 25
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ExtraObjectsMethodsForWeb {}
Reported by PMD.
Line: 25
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ExtraObjectsMethodsForWeb {}
Reported by PMD.
guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java
2 issues
Line: 63
@Override
public Set<N> adjacentNodes() {
return Collections.unmodifiableSet(adjacentNodesMultiset().elementSet());
}
private Multiset<N> adjacentNodesMultiset() {
Multiset<N> adjacentNodes = getReference(adjacentNodesReference);
if (adjacentNodes == null) {
Reported by PMD.
Line: 80
return new MultiEdgesConnecting<E>(incidentEdgeMap, node) {
@Override
public int size() {
return adjacentNodesMultiset().count(node);
}
};
}
@Override
Reported by PMD.