The following issues were found

guava-testlib/src/com/google/common/collect/testing/testers/MapSerializationTester.java
1 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

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapSerializationTester<K, V> extends AbstractMapTester<K, V> {
  @CollectionFeature.Require(SERIALIZABLE)
  public void testReserializeMap() {
    Map<K, V> deserialized = SerializableTester.reserialize(getMap());
    new EqualsTester().addEqualityGroup(getMap(), deserialized).testEquals();
  }
}

            

Reported by PMD.

guava-testlib/test/com/google/common/collect/testing/OpenJdk6SetTests.java
1 issues
JUnit 4 indicates test suites via annotations, not the suite method.
Design

Line: 38

               * @author Kevin Bourrillion
 */
public class OpenJdk6SetTests extends TestsForSetsInJavaUtil {
  public static Test suite() {
    return new OpenJdk6SetTests().allTests();
  }

  @Override
  protected Collection<Method> suppressForTreeSetNatural() {

            

Reported by PMD.

guava-testlib/test/com/google/common/collect/testing/OpenJdk6ListTests.java
1 issues
JUnit 4 indicates test suites via annotations, not the suite method.
Design

Line: 38

               * @author Kevin Bourrillion
 */
public class OpenJdk6ListTests extends TestsForListsInJavaUtil {
  public static Test suite() {
    return new OpenJdk6ListTests().allTests();
  }

  @Override
  protected Collection<Method> suppressForArraysAsList() {

            

Reported by PMD.

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

Line: 59

              @GwtCompatible
public class TestLogHandler extends Handler {
  /** We will keep a private list of all logged records */
  private final List<LogRecord> list = new ArrayList<>();

  /** Adds the most recently logged record to our list. */
  @Override
  public synchronized void publish(@Nullable LogRecord record) {
    list.add(record);

            

Reported by PMD.

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

Line: 28

              
/** Returns a random portion of the requested bytes on each call. */
class RandomAmountInputStream extends FilterInputStream {
  private final Random random;

  public RandomAmountInputStream(InputStream in, Random random) {
    super(checkNotNull(in));
    this.random = checkNotNull(random);
  }

            

Reported by PMD.

guava-testlib/test/com/google/common/collect/testing/OpenJdk6QueueTests.java
1 issues
JUnit 4 indicates test suites via annotations, not the suite method.
Design

Line: 35

               * @author Kevin Bourrillion
 */
public class OpenJdk6QueueTests extends TestsForQueuesInJavaUtil {
  public static Test suite() {
    return new OpenJdk6QueueTests().allTests();
  }

  private static final List<Method> PQ_SUPPRESS =
      Arrays.asList(getCreateWithNullUnsupportedMethod());

            

Reported by PMD.

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

Line: 33

               */
public class TestCharSink extends CharSink implements TestStreamSupplier {

  private final TestByteSink byteSink;

  public TestCharSink(TestOption... options) {
    this.byteSink = new TestByteSink(options);
  }


            

Reported by PMD.

guava-tests/test/com/google/common/math/MathTesting.java
1 issues
Avoid instantiating new objects inside loops
Performance

Line: 247

                    }
    }
    for (int i = Double.MIN_EXPONENT; i <= Double.MAX_EXPONENT; i++) {
      for (int direction : new int[] {1, -1}) {
        double d = Double.longBitsToDouble(Double.doubleToLongBits(Math.scalb(1.0, i)) + direction);
        // Math.nextUp/nextDown
        if (d != Math.rint(d)) {
          fractionalBuilder.add(d);
        }

            

Reported by PMD.

guava-testlib/src/com/google/common/testing/Platform.java
1 issues
Avoid throwing raw exception types.
Design

Line: 46

                    ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()));
      return (T) in.readObject();
    } catch (IOException | ClassNotFoundException e) {
      throw new RuntimeException(e);
    }
  }

  private Platform() {}
}

            

Reported by PMD.

guava-testlib/src/com/google/common/testing/SerializableTester.java
1 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 90

                public static <T> T reserializeAndAssert(T object) {
    T copy = reserialize(object);
    new EqualsTester().addEqualityGroup(object, copy).testEquals();
    Assert.assertEquals(object.getClass(), copy.getClass());
    return copy;
  }
}

            

Reported by PMD.