The following issues were found

guava/src/com/google/common/collect/TransformedListIterator.java
4 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 44

              
  @Override
  public final boolean hasPrevious() {
    return backingIterator().hasPrevious();
  }

  @Override
  @ParametricNullness
  public final T previous() {

            

Reported by PMD.

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

Line: 50

                @Override
  @ParametricNullness
  public final T previous() {
    return transform(backingIterator().previous());
  }

  @Override
  public final int nextIndex() {
    return backingIterator().nextIndex();

            

Reported by PMD.

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

Line: 55

              
  @Override
  public final int nextIndex() {
    return backingIterator().nextIndex();
  }

  @Override
  public final int previousIndex() {
    return backingIterator().previousIndex();

            

Reported by PMD.

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

Line: 60

              
  @Override
  public final int previousIndex() {
    return backingIterator().previousIndex();
  }

  @Override
  public void set(@ParametricNullness T element) {
    throw new UnsupportedOperationException();

            

Reported by PMD.

guava/src/com/google/common/collect/ImmutableEnumSet.java
4 issues
Avoid reassigning parameters such as 'collection'
Design

Line: 94

                }

  @Override
  public boolean containsAll(Collection<?> collection) {
    if (collection instanceof ImmutableEnumSet<?>) {
      collection = ((ImmutableEnumSet<?>) collection).delegate;
    }
    return delegate.containsAll(collection);
  }

            

Reported by PMD.

Avoid reassigning parameters such as 'object'
Design

Line: 107

                }

  @Override
  public boolean equals(@CheckForNull Object object) {
    if (object == this) {
      return true;
    }
    if (object instanceof ImmutableEnumSet) {
      object = ((ImmutableEnumSet<?>) object).delegate;

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 36

              @GwtCompatible(serializable = true, emulated = true)
@SuppressWarnings("serial") // we're overriding default serialization
@ElementTypesAreNonnullByDefault
final class ImmutableEnumSet<E extends Enum<E>> extends ImmutableSet<E> {
  @SuppressWarnings("rawtypes") // necessary to compile against Java 8
  static ImmutableSet asImmutable(EnumSet set) {
    switch (set.size()) {
      case 0:
        return ImmutableSet.of();

            

Reported by PMD.

Field hashCode has the same name as a method
Error

Line: 122

                  return true;
  }

  @LazyInit private transient int hashCode;

  @Override
  public int hashCode() {
    int result = hashCode;
    return (result == 0) ? hashCode = delegate.hashCode() : result;

            

Reported by PMD.

guava/src/com/google/common/collect/SingletonImmutableTable.java
4 issues
Classes implementing Serializable should set a serialVersionUID
Error

Line: 31

               */
@GwtCompatible
@ElementTypesAreNonnullByDefault
class SingletonImmutableTable<R, C, V> extends ImmutableTable<R, C, V> {
  final R singleRowKey;
  final C singleColumnKey;
  final V singleValue;

  SingletonImmutableTable(R rowKey, C columnKey, V value) {

            

Reported by PMD.

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

Line: 32

              @GwtCompatible
@ElementTypesAreNonnullByDefault
class SingletonImmutableTable<R, C, V> extends ImmutableTable<R, C, V> {
  final R singleRowKey;
  final C singleColumnKey;
  final V singleValue;

  SingletonImmutableTable(R rowKey, C columnKey, V value) {
    this.singleRowKey = checkNotNull(rowKey);

            

Reported by PMD.

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

Line: 33

              @ElementTypesAreNonnullByDefault
class SingletonImmutableTable<R, C, V> extends ImmutableTable<R, C, V> {
  final R singleRowKey;
  final C singleColumnKey;
  final V singleValue;

  SingletonImmutableTable(R rowKey, C columnKey, V value) {
    this.singleRowKey = checkNotNull(rowKey);
    this.singleColumnKey = checkNotNull(columnKey);

            

Reported by PMD.

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

Line: 34

              class SingletonImmutableTable<R, C, V> extends ImmutableTable<R, C, V> {
  final R singleRowKey;
  final C singleColumnKey;
  final V singleValue;

  SingletonImmutableTable(R rowKey, C columnKey, V value) {
    this.singleRowKey = checkNotNull(rowKey);
    this.singleColumnKey = checkNotNull(columnKey);
    this.singleValue = checkNotNull(value);

            

Reported by PMD.

guava-tests/test/com/google/common/collect/ForwardingSetMultimapTest.java
4 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: 31

               */
public class ForwardingSetMultimapTest extends TestCase {

  @SuppressWarnings("rawtypes")
  public void testForwarding() {
    new ForwardingWrapperTester()
        .testForwarding(
            SetMultimap.class,
            new Function<SetMultimap, SetMultimap>() {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 32

              public class ForwardingSetMultimapTest extends TestCase {

  @SuppressWarnings("rawtypes")
  public void testForwarding() {
    new ForwardingWrapperTester()
        .testForwarding(
            SetMultimap.class,
            new Function<SetMultimap, SetMultimap>() {
              @Override

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 44

                          });
  }

  public void testEquals() {
    SetMultimap<Integer, String> map1 = ImmutableSetMultimap.of(1, "one");
    SetMultimap<Integer, String> map2 = ImmutableSetMultimap.of(2, "two");
    new EqualsTester()
        .addEqualityGroup(map1, wrap(map1), wrap(map1))
        .addEqualityGroup(map2, wrap(map2))

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 44

                          });
  }

  public void testEquals() {
    SetMultimap<Integer, String> map1 = ImmutableSetMultimap.of(1, "one");
    SetMultimap<Integer, String> map2 = ImmutableSetMultimap.of(2, "two");
    new EqualsTester()
        .addEqualityGroup(map1, wrap(map1), wrap(map1))
        .addEqualityGroup(map2, wrap(map2))

            

Reported by PMD.

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

Line: 34

               */
public final class TestByteSource extends ByteSource implements TestStreamSupplier {

  private final byte[] bytes;
  private final ImmutableSet<TestOption> options;

  private boolean inputStreamOpened;
  private boolean inputStreamClosed;


            

Reported by PMD.

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

Line: 35

              public final class TestByteSource extends ByteSource implements TestStreamSupplier {

  private final byte[] bytes;
  private final ImmutableSet<TestOption> options;

  private boolean inputStreamOpened;
  private boolean inputStreamClosed;

  TestByteSource(byte[] bytes, TestOption... options) {

            

Reported by PMD.

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

Line: 37

                private final byte[] bytes;
  private final ImmutableSet<TestOption> options;

  private boolean inputStreamOpened;
  private boolean inputStreamClosed;

  TestByteSource(byte[] bytes, TestOption... options) {
    this.bytes = checkNotNull(bytes);
    this.options = ImmutableSet.copyOf(options);

            

Reported by PMD.

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

Line: 38

                private final ImmutableSet<TestOption> options;

  private boolean inputStreamOpened;
  private boolean inputStreamClosed;

  TestByteSource(byte[] bytes, TestOption... options) {
    this.bytes = checkNotNull(bytes);
    this.options = ImmutableSet.copyOf(options);
  }

            

Reported by PMD.

guava-tests/test/com/google/common/cache/TestingCacheLoaders.java
4 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: 34

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

  /**
   * Returns a {@link CacheLoader} that implements a naive {@link CacheLoader#loadAll}, delegating
   * {@link CacheLoader#load} calls to {@code loader}.
   */

            

Reported by PMD.

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

Line: 115

                }

  static final class ConstantLoader<K, V> extends CacheLoader<K, V> {
    private final V constant;

    ConstantLoader(V constant) {
      this.constant = constant;
    }


            

Reported by PMD.

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

Line: 134

                 * and {@link #getReloadCount}.
   */
  static class IncrementingLoader extends CacheLoader<Integer, Integer> {
    private final AtomicInteger countLoad = new AtomicInteger();
    private final AtomicInteger countReload = new AtomicInteger();

    @Override
    public Integer load(Integer key) {
      countLoad.incrementAndGet();

            

Reported by PMD.

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

Line: 135

                 */
  static class IncrementingLoader extends CacheLoader<Integer, Integer> {
    private final AtomicInteger countLoad = new AtomicInteger();
    private final AtomicInteger countReload = new AtomicInteger();

    @Override
    public Integer load(Integer key) {
      countLoad.incrementAndGet();
      return key;

            

Reported by PMD.

guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java
4 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 38

              @Beta
@GwtIncompatible
public class MockFutureListener implements Runnable {
  private final CountDownLatch countDownLatch;
  private final ListenableFuture<?> future;

  public MockFutureListener(ListenableFuture<?> future) {
    this.countDownLatch = new CountDownLatch(1);
    this.future = future;

            

Reported by PMD.

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

Line: 39

              @GwtIncompatible
public class MockFutureListener implements Runnable {
  private final CountDownLatch countDownLatch;
  private final ListenableFuture<?> future;

  public MockFutureListener(ListenableFuture<?> future) {
    this.countDownLatch = new CountDownLatch(1);
    this.future = future;


            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 76

                 * throws an {@code ExecutableException} and that the cause of the {@code ExecutableException} is
   * {@code expectedCause}.
   */
  public void assertException(Throwable expectedCause) throws Exception {
    // Verify that the listener executed in a reasonable amount of time.
    Assert.assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));

    try {
      future.get();

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 88

                  }
  }

  public void assertTimeout() throws Exception {
    // Verify that the listener does not get called in a reasonable amount of
    // time.
    Assert.assertFalse(countDownLatch.await(1L, TimeUnit.SECONDS));
  }
}

            

Reported by PMD.

guava-tests/test/com/google/common/collect/ForwardingListMultimapTest.java
4 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: 31

               */
public class ForwardingListMultimapTest extends TestCase {

  @SuppressWarnings("rawtypes")
  public void testForwarding() {
    new ForwardingWrapperTester()
        .testForwarding(
            ListMultimap.class,
            new Function<ListMultimap, ListMultimap>() {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 32

              public class ForwardingListMultimapTest extends TestCase {

  @SuppressWarnings("rawtypes")
  public void testForwarding() {
    new ForwardingWrapperTester()
        .testForwarding(
            ListMultimap.class,
            new Function<ListMultimap, ListMultimap>() {
              @Override

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 44

                          });
  }

  public void testEquals() {
    ListMultimap<Integer, String> map1 = ImmutableListMultimap.of(1, "one");
    ListMultimap<Integer, String> map2 = ImmutableListMultimap.of(2, "two");
    new EqualsTester()
        .addEqualityGroup(map1, wrap(map1), wrap(map1))
        .addEqualityGroup(map2, wrap(map2))

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 44

                          });
  }

  public void testEquals() {
    ListMultimap<Integer, String> map1 = ImmutableListMultimap.of(1, "one");
    ListMultimap<Integer, String> map2 = ImmutableListMultimap.of(2, "two");
    new EqualsTester()
        .addEqualityGroup(map1, wrap(map1), wrap(map1))
        .addEqualityGroup(map2, wrap(map2))

            

Reported by PMD.

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

Line: 35

                  return Arrays.asList(new Object[][] {{false}, {true}});
  }

  private final boolean allowsSelfLoops;
  private ImmutableGraph.Builder<Integer> graphBuilder;

  public StandardImmutableDirectedGraphTest(boolean allowsSelfLoops) {
    this.allowsSelfLoops = allowsSelfLoops;
  }

            

Reported by PMD.

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

Line: 36

                }

  private final boolean allowsSelfLoops;
  private ImmutableGraph.Builder<Integer> graphBuilder;

  public StandardImmutableDirectedGraphTest(boolean allowsSelfLoops) {
    this.allowsSelfLoops = allowsSelfLoops;
  }


            

Reported by PMD.

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

Line: 44

              
  @Override
  public Graph<Integer> createGraph() {
    graphBuilder = GraphBuilder.directed().allowsSelfLoops(allowsSelfLoops).immutable();
    return graphBuilder.build();
  }

  @Override
  final void addNode(Integer n) {

            

Reported by PMD.

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

Line: 44

              
  @Override
  public Graph<Integer> createGraph() {
    graphBuilder = GraphBuilder.directed().allowsSelfLoops(allowsSelfLoops).immutable();
    return graphBuilder.build();
  }

  @Override
  final void addNode(Integer n) {

            

Reported by PMD.

guava-tests/benchmark/com/google/common/cache/MapMakerComparisonBenchmark.java
4 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 34

                private static final String TEST_VALUE = "test value";

  // Non-loading versions:
  private final Map<Object, Object> map = new MapMaker().makeMap(); // Returns ConcurrentHashMap
  private final Cache<Object, Object> cache = CacheBuilder.newBuilder().recordStats().build();
  private final Cache<Object, Object> cacheNoStats = CacheBuilder.newBuilder().build();

  @BeforeExperiment
  void setUp() {

            

Reported by PMD.

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

Line: 35

              
  // Non-loading versions:
  private final Map<Object, Object> map = new MapMaker().makeMap(); // Returns ConcurrentHashMap
  private final Cache<Object, Object> cache = CacheBuilder.newBuilder().recordStats().build();
  private final Cache<Object, Object> cacheNoStats = CacheBuilder.newBuilder().build();

  @BeforeExperiment
  void setUp() {
    map.put(TEST_KEY, TEST_VALUE);

            

Reported by PMD.

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

Line: 36

                // Non-loading versions:
  private final Map<Object, Object> map = new MapMaker().makeMap(); // Returns ConcurrentHashMap
  private final Cache<Object, Object> cache = CacheBuilder.newBuilder().recordStats().build();
  private final Cache<Object, Object> cacheNoStats = CacheBuilder.newBuilder().build();

  @BeforeExperiment
  void setUp() {
    map.put(TEST_KEY, TEST_VALUE);
    cache.put(TEST_KEY, TEST_VALUE);

            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 38

                private final Cache<Object, Object> cache = CacheBuilder.newBuilder().recordStats().build();
  private final Cache<Object, Object> cacheNoStats = CacheBuilder.newBuilder().build();

  @BeforeExperiment
  void setUp() {
    map.put(TEST_KEY, TEST_VALUE);
    cache.put(TEST_KEY, TEST_VALUE);
    cacheNoStats.put(TEST_KEY, TEST_VALUE);
  }

            

Reported by PMD.