The following issues were found

guava/src/com/google/common/base/FunctionalEquivalence.java
2 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

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.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

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
Field nullsFirst has the same name as a method
Error

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.

Field nullsLast has the same name as a method
Error

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
Avoid reassigning parameters such as 'list'
Design

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.

Potential violation of Law of Demeter (object not created locally)
Design

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
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 29

               */
@GwtCompatible
public class RunnablesTest extends TestCase {
  public void testDoNothingRunnableIsSingleton() {
    assertSame(Runnables.doNothing(), Runnables.doNothing());
  }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

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
No abstract method which means that the keyword is most likely used to prevent instantiation. Use a private or protected constructor instead.
Design

Line: 25

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ShortsMethodsForWeb {}

            

Reported by PMD.

This abstract class does not have any abstract methods
Design

Line: 25

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ShortsMethodsForWeb {}

            

Reported by PMD.

guava/src/com/google/common/collect/AbstractSortedSetMultimap.java
2 issues
Overriding method merely calls super
Design

Line: 135

                 * SortedSet} values.
   */
  @Override
  public Map<K, Collection<V>> asMap() {
    return super.asMap();
  }

  /**
   * {@inheritDoc}

            

Reported by PMD.

Overriding method merely calls super
Design

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
No abstract method which means that the keyword is most likely used to prevent instantiation. Use a private or protected constructor instead.
Design

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.

This abstract class does not have any abstract methods
Design

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
This class has too many methods, consider refactoring it.
Design

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.

Potential violation of Law of Demeter (method chain calls)
Design

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
No abstract method which means that the keyword is most likely used to prevent instantiation. Use a private or protected constructor instead.
Design

Line: 25

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ExtraObjectsMethodsForWeb {}

            

Reported by PMD.

This abstract class does not have any abstract methods
Design

Line: 25

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ExtraObjectsMethodsForWeb {}

            

Reported by PMD.

guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java
2 issues
Potential violation of Law of Demeter (method chain calls)
Design

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.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 80

                  return new MultiEdgesConnecting<E>(incidentEdgeMap, node) {
      @Override
      public int size() {
        return adjacentNodesMultiset().count(node);
      }
    };
  }

  @Override

            

Reported by PMD.