The following issues were found

android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIsEmptyTester.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: 35

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionIsEmptyTester<E> extends AbstractCollectionTester<E> {
  @CollectionSize.Require(ZERO)
  public void testIsEmpty_yes() {
    assertTrue("isEmpty() should return true", collection.isEmpty());
  }

  @CollectionSize.Require(absent = ZERO)

            

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: 40

                  assertTrue("isEmpty() should return true", collection.isEmpty());
  }

  @CollectionSize.Require(absent = ZERO)
  public void testIsEmpty_no() {
    assertFalse("isEmpty() should return false", collection.isEmpty());
  }
}

            

Reported by PMD.

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

Line: 39

              
  @Override
  protected Map<String, Collection<Integer>> makeEmptyMap() {
    return Multimaps.unmodifiableMultimap(LinkedHashMultimap.<String, Integer>create()).asMap();
  }

  @Override
  protected Map<String, Collection<Integer>> makePopulatedMap() {
    Multimap<String, Integer> delegate = LinkedHashMultimap.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 = LinkedHashMultimap.create();
    populate(delegate);
    return Multimaps.unmodifiableMultimap(delegate).asMap();
  }
}

            

Reported by PMD.

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

Line: 30

              @GwtCompatible
public final class DerivedTestIteratorGenerator<E>
    implements TestIteratorGenerator<E>, DerivedGenerator {
  private final TestSubjectGenerator<? extends Iterable<E>> collectionGenerator;

  public DerivedTestIteratorGenerator(
      TestSubjectGenerator<? extends Iterable<E>> collectionGenerator) {
    this.collectionGenerator = collectionGenerator;
  }

            

Reported by PMD.

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

Line: 44

              
  @Override
  public Iterator<E> get() {
    return collectionGenerator.createTestSubject().iterator();
  }
}

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/CollectionTestSuiteBuilder.java
2 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 53

                        parentBuilder) {
    List<TestSuite> derivedSuites = new ArrayList<>(super.createDerivedSuites(parentBuilder));

    if (parentBuilder.getFeatures().contains(SERIALIZABLE)) {
      derivedSuites.add(
          CollectionTestSuiteBuilder.using(
                  new ReserializedCollectionGenerator<E>(parentBuilder.getSubjectGenerator()))
              .named(getName() + " reserialized")
              .withFeatures(computeReserializedCollectionFeatures(parentBuilder.getFeatures()))

            

Reported by PMD.

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

Line: 68

                }

  static class ReserializedCollectionGenerator<E> implements TestCollectionGenerator<E> {
    final OneSizeTestContainerGenerator<Collection<E>, E> gen;

    private ReserializedCollectionGenerator(OneSizeTestContainerGenerator<Collection<E>, E> gen) {
      this.gen = gen;
    }


            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java
2 issues
A class which only has private constructors should be final
Design

Line: 34

               * @author Regina O'Dell
 */
@GwtCompatible
public class MinimalSet<E> extends MinimalCollection<E> implements Set<E> {

  @SuppressWarnings("unchecked") // empty Object[] as E[]
  public static <E> MinimalSet<E> of(E... contents) {
    return ofClassAndContents(Object.class, (E[]) new Object[0], Arrays.asList(contents));
  }

            

Reported by PMD.

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

Line: 69

                public boolean equals(Object object) {
    if (object instanceof Set) {
      Set<?> that = (Set<?>) object;
      return (this.size() == that.size()) && this.containsAll(that);
    }
    return false;
  }

  @Override

            

Reported by PMD.

android/guava-testlib/src/com/google/common/testing/TearDown.java
2 issues
A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 47

                 * @throws Exception for any reason. {@code TearDownTestCase} ensures that any exception thrown
   *     will not interfere with other TearDown operations.
   */
  void tearDown() throws Exception;
}

            

Reported by PMD.

JUnit 4 tests that clean up tests should use the @After annotation, JUnit5 tests should use @AfterEach or @AfterAll
Design

Line: 47

                 * @throws Exception for any reason. {@code TearDownTestCase} ensures that any exception thrown
   *     will not interfere with other TearDown operations.
   */
  void tearDown() throws Exception;
}

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/SpecialRandom.java
2 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 34

                  return (s.length() == 0) ? new SpecialRandom() : new SpecialRandom(Long.parseLong(s));
  }

  private final boolean hasSeed;
  private final long seed;

  public SpecialRandom() {
    this.hasSeed = false;
    this.seed = 0;

            

Reported by PMD.

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

Line: 35

                }

  private final boolean hasSeed;
  private final long seed;

  public SpecialRandom() {
    this.hasSeed = false;
    this.seed = 0;
  }

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/testers/ListHashCodeTester.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: 33

              @GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListHashCodeTester<E> extends AbstractListTester<E> {
  public void testHashCode() {
    int expectedHashCode = 1;
    for (E element : getOrderedElements()) {
      expectedHashCode = 31 * expectedHashCode + ((element == null) ? 0 : element.hashCode());
    }
    assertEquals(

            

Reported by PMD.

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

Line: 41

                  assertEquals(
        "A List's hashCode() should be computed from those of its elements.",
        expectedHashCode,
        getList().hashCode());
  }

  /**
   * Returns the {@link Method} instance for {@link #testHashCode()} so that list tests on
   * unhashable objects can suppress it with {@code FeatureSpecificTestSuiteBuilder.suppressing()}.

            

Reported by PMD.

android/guava-tests/benchmark/com/google/common/eventbus/EventBusBenchmark.java
2 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 29

               */
public class EventBusBenchmark {

  private EventBus eventBus;

  @BeforeExperiment
  void setUp() {
    eventBus = new EventBus("for benchmarking purposes");
    eventBus.register(this);

            

Reported by PMD.

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

Line: 31

              
  private EventBus eventBus;

  @BeforeExperiment
  void setUp() {
    eventBus = new EventBus("for benchmarking purposes");
    eventBus.register(this);
  }


            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.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: 31

                 * RegularImmutableAsList should assume its input is null-free without checking, because it only
   * gets invoked from other immutable collections.
   */
  public void testDoesntCheckForNull() {
    ImmutableSet<Integer> set = ImmutableSet.of(1, 2, 3);
    new RegularImmutableAsList<Integer>(set, new Object[] {null, null, null});
    // shouldn't throw!
  }
}

            

Reported by PMD.

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

Line: 31

                 * RegularImmutableAsList should assume its input is null-free without checking, because it only
   * gets invoked from other immutable collections.
   */
  public void testDoesntCheckForNull() {
    ImmutableSet<Integer> set = ImmutableSet.of(1, 2, 3);
    new RegularImmutableAsList<Integer>(set, new Object[] {null, null, null});
    // shouldn't throw!
  }
}

            

Reported by PMD.