The following issues were found

guava-tests/test/com/google/common/io/TestInputStream.java
3 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 34

              /** @author Colin Decker */
public class TestInputStream extends FilterInputStream {

  private final ImmutableSet<TestOption> options;
  private boolean closed;

  public TestInputStream(InputStream in, TestOption... options) throws IOException {
    this(in, Arrays.asList(options));
  }

            

Reported by PMD.

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

Line: 35

              public class TestInputStream extends FilterInputStream {

  private final ImmutableSet<TestOption> options;
  private boolean closed;

  public TestInputStream(InputStream in, TestOption... options) throws IOException {
    this(in, Arrays.asList(options));
  }


            

Reported by PMD.

Field closed has the same name as a method
Error

Line: 35

              public class TestInputStream extends FilterInputStream {

  private final ImmutableSet<TestOption> options;
  private boolean closed;

  public TestInputStream(InputStream in, TestOption... options) throws IOException {
    this(in, Arrays.asList(options));
  }


            

Reported by PMD.

guava-tests/test/com/google/common/io/TestOutputStream.java
3 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 33

              /** @author Colin Decker */
public class TestOutputStream extends FilterOutputStream {

  private final ImmutableSet<TestOption> options;
  private boolean closed;

  public TestOutputStream(OutputStream out, TestOption... options) throws IOException {
    this(out, Arrays.asList(options));
  }

            

Reported by PMD.

Field closed has the same name as a method
Error

Line: 34

              public class TestOutputStream extends FilterOutputStream {

  private final ImmutableSet<TestOption> options;
  private boolean closed;

  public TestOutputStream(OutputStream out, TestOption... options) throws IOException {
    this(out, Arrays.asList(options));
  }


            

Reported by PMD.

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

Line: 34

              public class TestOutputStream extends FilterOutputStream {

  private final ImmutableSet<TestOption> options;
  private boolean closed;

  public TestOutputStream(OutputStream out, TestOption... options) throws IOException {
    this(out, Arrays.asList(options));
  }


            

Reported by PMD.

guava-tests/test/com/google/common/cache/TestingRemovalListeners.java
3 issues
All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 28

               * @author mike nonemacher
 */
@GwtCompatible(emulated = true)
class TestingRemovalListeners {

  /** Returns a new no-op {@code RemovalListener}. */
  static <K, V> NullRemovalListener<K, V> nullRemovalListener() {
    return new NullRemovalListener<>();
  }

            

Reported by PMD.

Classes implementing Serializable should set a serialVersionUID
Error

Line: 48

              
  /** {@link RemovalListener} that adds all {@link RemovalNotification} objects to a queue. */
  @GwtIncompatible // ConcurrentLinkedQueue
  static class QueuingRemovalListener<K, V> extends ConcurrentLinkedQueue<RemovalNotification<K, V>>
      implements RemovalListener<K, V> {

    @Override
    public void onRemoval(RemovalNotification<K, V> notification) {
      add(notification);

            

Reported by PMD.

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

Line: 63

                 */
  static class CountingRemovalListener<K, V> implements RemovalListener<K, V> {
    private final AtomicInteger count = new AtomicInteger();
    private volatile RemovalNotification<K, V> lastNotification;

    @Override
    public void onRemoval(RemovalNotification<K, V> notification) {
      count.incrementAndGet();
      lastNotification = notification;

            

Reported by PMD.

guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java
3 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 40

                @Override
  protected SortedMap<String, String> makePopulatedMap() {
    SortedMap<String, Integer> underlying = Maps.newTreeMap();
    underlying.put("a", 1);
    underlying.put("b", 2);
    underlying.put("c", 3);
    return Maps.transformValues(underlying, Functions.toStringFunction());
  }
}

            

Reported by PMD.

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

Line: 41

                protected SortedMap<String, String> makePopulatedMap() {
    SortedMap<String, Integer> underlying = Maps.newTreeMap();
    underlying.put("a", 1);
    underlying.put("b", 2);
    underlying.put("c", 3);
    return Maps.transformValues(underlying, Functions.toStringFunction());
  }
}

            

Reported by PMD.

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

Line: 42

                  SortedMap<String, Integer> underlying = Maps.newTreeMap();
    underlying.put("a", 1);
    underlying.put("b", 2);
    underlying.put("c", 3);
    return Maps.transformValues(underlying, Functions.toStringFunction());
  }
}

            

Reported by PMD.

guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java
3 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 39

              
  @Override
  protected Map<String, Collection<Integer>> makeEmptyMap() {
    return ImmutableMultimap.<String, Integer>of().asMap();
  }

  @Override
  protected Map<String, Collection<Integer>> makePopulatedMap() {
    Multimap<String, Integer> delegate = HashMultimap.create();

            

Reported by PMD.

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

Line: 39

              
  @Override
  protected Map<String, Collection<Integer>> makeEmptyMap() {
    return ImmutableMultimap.<String, Integer>of().asMap();
  }

  @Override
  protected Map<String, Collection<Integer>> makePopulatedMap() {
    Multimap<String, Integer> delegate = HashMultimap.create();

            

Reported by PMD.

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

Line: 46

                protected Map<String, Collection<Integer>> makePopulatedMap() {
    Multimap<String, Integer> delegate = HashMultimap.create();
    populate(delegate);
    return ImmutableMultimap.copyOf(delegate).asMap();
  }
}

            

Reported by PMD.

guava-testlib/src/com/google/common/collect/testing/google/SetMultimapReplaceValuesTester.java
3 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: 37

              public class SetMultimapReplaceValuesTester<K, V>
    extends AbstractMultimapTester<K, V, SetMultimap<K, V>> {

  @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
  public void testReplaceValuesHandlesDuplicates() {
    @SuppressWarnings("unchecked")
    List<V> values = Arrays.asList(v0(), v1(), v0());

    for (K k : sampleKeys()) {

            

Reported by PMD.

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

Line: 44

              
    for (K k : sampleKeys()) {
      resetContainer();
      multimap().replaceValues(k, values);
      assertGet(k, v0(), v1());
    }
  }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'values' (lines '40'-'47').
Error

Line: 40

                @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
  public void testReplaceValuesHandlesDuplicates() {
    @SuppressWarnings("unchecked")
    List<V> values = Arrays.asList(v0(), v1(), v0());

    for (K k : sampleKeys()) {
      resetContainer();
      multimap().replaceValues(k, values);
      assertGet(k, v0(), v1());

            

Reported by PMD.

guava-testlib/src/com/google/common/collect/testing/google/SetMultimapEqualsTester.java
3 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: 34

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class SetMultimapEqualsTester<K, V> extends AbstractMultimapTester<K, V, SetMultimap<K, V>> {
  @CollectionSize.Require(SEVERAL)
  public void testOrderingDoesntAffectEqualsComparisons() {
    SetMultimap<K, V> multimap1 =
        getSubjectGenerator()
            .create(
                Helpers.mapEntry(k0(), v0()),

            

Reported by PMD.

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

Line: 37

                @CollectionSize.Require(SEVERAL)
  public void testOrderingDoesntAffectEqualsComparisons() {
    SetMultimap<K, V> multimap1 =
        getSubjectGenerator()
            .create(
                Helpers.mapEntry(k0(), v0()),
                Helpers.mapEntry(k0(), v1()),
                Helpers.mapEntry(k0(), v4()));
    SetMultimap<K, V> multimap2 =

            

Reported by PMD.

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

Line: 43

                              Helpers.mapEntry(k0(), v1()),
                Helpers.mapEntry(k0(), v4()));
    SetMultimap<K, V> multimap2 =
        getSubjectGenerator()
            .create(
                Helpers.mapEntry(k0(), v1()),
                Helpers.mapEntry(k0(), v0()),
                Helpers.mapEntry(k0(), v4()));
    new EqualsTester().addEqualityGroup(multimap1, multimap2).testEquals();

            

Reported by PMD.

android/guava/src/com/google/common/collect/ImmutableSortedSetFauxverideShim.java
3 issues
Classes implementing Serializable should set a serialVersionUID
Error

Line: 41

               */
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet<E> {
  /**
   * Not supported. Use {@link ImmutableSortedSet#naturalOrder}, which offers better type-safety,
   * instead. This method exists only to hide {@link ImmutableSet#builder} from consumers of {@code
   * ImmutableSortedSet}.
   *

            

Reported by PMD.

The String literal 'Pass parameters of type Comparable' appears 6 times in this file; the first occurrence is on line 93
Error

Line: 93

                 * @deprecated <b>Pass the parameters of type {@code Comparable} to use {@link
   *     ImmutableSortedSet#of(Comparable, Comparable)}.</b>
   */
  @DoNotCall("Pass parameters of type Comparable")
  @Deprecated
  public static <E> ImmutableSortedSet<E> of(E e1, E e2) {
    throw new UnsupportedOperationException();
  }


            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 171

                 */
  @DoNotCall("Pass parameters of type Comparable")
  @Deprecated
  public static <E> ImmutableSortedSet<E> copyOf(E[] elements) {
    throw new UnsupportedOperationException();
  }

  /*
   * We would like to include an unsupported "<E> copyOf(Iterable<E>)" here,

            

Reported by PMD.

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/JdkBackedImmutableBiMap.java
3 issues
A class which only has private constructors should be final
Design

Line: 22

               * GWT emulation of {@link JdkBackedImmutableBiMap}. Never used, but must exist so that the client
 * is willing to deserialize maps that were this type on the server.
 */
class JdkBackedImmutableBiMap<K, V> extends RegularImmutableBiMap<K, V> {
  private JdkBackedImmutableBiMap(ImmutableMap<K, V> delegate, ImmutableBiMap<V, K> inverse) {
    super(delegate, inverse);
  }
}

            

Reported by PMD.

Class cannot be instantiated and does not provide any static methods or fields
Error

Line: 22

               * GWT emulation of {@link JdkBackedImmutableBiMap}. Never used, but must exist so that the client
 * is willing to deserialize maps that were this type on the server.
 */
class JdkBackedImmutableBiMap<K, V> extends RegularImmutableBiMap<K, V> {
  private JdkBackedImmutableBiMap(ImmutableMap<K, V> delegate, ImmutableBiMap<V, K> inverse) {
    super(delegate, inverse);
  }
}

            

Reported by PMD.

Classes implementing Serializable should set a serialVersionUID
Error

Line: 22

               * GWT emulation of {@link JdkBackedImmutableBiMap}. Never used, but must exist so that the client
 * is willing to deserialize maps that were this type on the server.
 */
class JdkBackedImmutableBiMap<K, V> extends RegularImmutableBiMap<K, V> {
  private JdkBackedImmutableBiMap(ImmutableMap<K, V> delegate, ImmutableBiMap<V, K> inverse) {
    super(delegate, inverse);
  }
}

            

Reported by PMD.

android/guava/src/com/google/common/collect/NullsFirstOrdering.java
3 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 29

              @ElementTypesAreNonnullByDefault
final class NullsFirstOrdering<T extends @Nullable Object> extends Ordering<@Nullable T>
    implements Serializable {
  final Ordering<? super T> ordering;

  NullsFirstOrdering(Ordering<? super T> ordering) {
    this.ordering = ordering;
  }


            

Reported by PMD.

Use equals() to compare object references.
Error

Line: 37

              
  @Override
  public int compare(@CheckForNull T left, @CheckForNull T right) {
    if (left == right) {
      return 0;
    }
    if (left == null) {
      return RIGHT_IS_GREATER;
    }

            

Reported by PMD.

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

Line: 53

                @SuppressWarnings("nullness") // should be safe, but not sure if we can avoid the warning
  public <S extends @Nullable T> Ordering<S> reverse() {
    // ordering.reverse() might be optimized, so let it do its thing
    return ordering.reverse().nullsLast();
  }

  @SuppressWarnings("unchecked") // still need the right way to explain this
  @Override
  public <S extends T> Ordering<@Nullable S> nullsFirst() {

            

Reported by PMD.