The following issues were found

android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java
22 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: 47

                  return (ConcurrentMap<K, V>) super.getMap();
  }

  @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplace_supportedPresent() {
    assertEquals(v0(), getMap().replace(k0(), v3()));
    expectReplacement(entry(k0(), v3()));
  }

            

Reported by PMD.

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

Line: 50

                @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplace_supportedPresent() {
    assertEquals(v0(), getMap().replace(k0(), v3()));
    expectReplacement(entry(k0(), v3()));
  }

  @MapFeature.Require(SUPPORTS_PUT)
  @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: 54

                  expectReplacement(entry(k0(), v3()));
  }

  @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplace_supportedPresentNoChange() {
    assertEquals(v0(), getMap().replace(k0(), v0()));
    expectUnchanged();
  }

            

Reported by PMD.

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

Line: 57

                @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplace_supportedPresentNoChange() {
    assertEquals(v0(), getMap().replace(k0(), v0()));
    expectUnchanged();
  }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testReplace_supportedAbsent() {

            

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

                  expectUnchanged();
  }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testReplace_supportedAbsent() {
    assertNull(getMap().replace(k3(), v3()));
    expectUnchanged();
  }


            

Reported by PMD.

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

Line: 63

              
  @MapFeature.Require(SUPPORTS_PUT)
  public void testReplace_supportedAbsent() {
    assertNull(getMap().replace(k3(), v3()));
    expectUnchanged();
  }

  @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
  @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: 67

                  expectUnchanged();
  }

  @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
  @CollectionSize.Require(absent = ZERO)
  public void testReplace_presentNullValueUnsupported() {
    try {
      getMap().replace(k0(), null);
      fail("Expected NullPointerException");

            

Reported by PMD.

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

Line: 71

                @CollectionSize.Require(absent = ZERO)
  public void testReplace_presentNullValueUnsupported() {
    try {
      getMap().replace(k0(), null);
      fail("Expected NullPointerException");
    } catch (NullPointerException expected) {
    }
    expectUnchanged();
  }

            

Reported by PMD.

Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 73

                  try {
      getMap().replace(k0(), null);
      fail("Expected NullPointerException");
    } catch (NullPointerException expected) {
    }
    expectUnchanged();
  }

  @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUE_QUERIES)

            

Reported by PMD.

Avoid catching NullPointerException; consider removing the cause of the NPE.
Error

Line: 73

                  try {
      getMap().replace(k0(), null);
      fail("Expected NullPointerException");
    } catch (NullPointerException expected) {
    }
    expectUnchanged();
  }

  @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUE_QUERIES)

            

Reported by PMD.

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

Line: 46

                  }
  }

  @Param EncodingOption encoding;

  @Param({"10", "100", "10000"})
  int n;

  private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];

            

Reported by PMD.

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

Line: 49

                @Param EncodingOption encoding;

  @Param({"10", "100", "10000"})
  int n;

  private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];
  private final String[] decodingInputs = new String[INPUTS_COUNT];

  @BeforeExperiment

            

Reported by PMD.

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

Line: 51

                @Param({"10", "100", "10000"})
  int n;

  private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];
  private final String[] decodingInputs = new String[INPUTS_COUNT];

  @BeforeExperiment
  public void setUp() {
    Random rng = new Random();

            

Reported by PMD.

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

Line: 52

                int n;

  private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];
  private final String[] decodingInputs = new String[INPUTS_COUNT];

  @BeforeExperiment
  public void setUp() {
    Random rng = new Random();
    for (int i = 0; i < encodingInputs.length; i++) {

            

Reported by PMD.

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

Line: 54

                private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];
  private final String[] decodingInputs = new String[INPUTS_COUNT];

  @BeforeExperiment
  public void setUp() {
    Random rng = new Random();
    for (int i = 0; i < encodingInputs.length; i++) {
      encodingInputs[i] = new byte[n];
      rng.nextBytes(encodingInputs[i]);

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 60

                  for (int i = 0; i < encodingInputs.length; i++) {
      encodingInputs[i] = new byte[n];
      rng.nextBytes(encodingInputs[i]);
      decodingInputs[i] = encoding.encoding.encode(encodingInputs[i]);
    }
  }

  @Benchmark
  public int encode(int reps) {

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 68

                public int encode(int reps) {
    int tmp = 0;
    for (int i = 0; i < reps; i++) {
      tmp += System.identityHashCode(encoding.encoding.encode(encodingInputs[i & INPUTS_MASK]));
    }
    return tmp;
  }

  @Benchmark

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 77

                public int decode(int reps) {
    int tmp = 0;
    for (int i = 0; i < reps; i++) {
      tmp += System.identityHashCode(encoding.encoding.decode(decodingInputs[i & INPUTS_MASK]));
    }
    return tmp;
  }

  @Benchmark

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 86

                public int encodingStream(int reps) throws IOException {
    int tmp = 0;
    for (int i = 0; i < reps; i++) {
      StringWriter target = new StringWriter(2 * n);
      OutputStream encodingStream = encoding.encoding.encodingStream(target);
      encodingStream.write(encodingInputs[i & INPUTS_MASK]);
      encodingStream.close();
      tmp += target.getBuffer().length();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 87

                  int tmp = 0;
    for (int i = 0; i < reps; i++) {
      StringWriter target = new StringWriter(2 * n);
      OutputStream encodingStream = encoding.encoding.encodingStream(target);
      encodingStream.write(encodingInputs[i & INPUTS_MASK]);
      encodingStream.close();
      tmp += target.getBuffer().length();
    }
    return tmp;

            

Reported by PMD.

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

Line: 43

              @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class SortedSetNavigationTester<E> extends AbstractSetTester<E> {

  private SortedSet<E> sortedSet;
  private List<E> values;
  private E a;
  private E b;
  private E c;


            

Reported by PMD.

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

Line: 44

              public class SortedSetNavigationTester<E> extends AbstractSetTester<E> {

  private SortedSet<E> sortedSet;
  private List<E> values;
  private E a;
  private E b;
  private E c;

  @Override

            

Reported by PMD.

Perhaps 'values' could be replaced by a local variable.
Design

Line: 44

              public class SortedSetNavigationTester<E> extends AbstractSetTester<E> {

  private SortedSet<E> sortedSet;
  private List<E> values;
  private E a;
  private E b;
  private E c;

  @Override

            

Reported by PMD.

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

Line: 45

              
  private SortedSet<E> sortedSet;
  private List<E> values;
  private E a;
  private E b;
  private E c;

  @Override
  public void setUp() throws Exception {

            

Reported by PMD.

Avoid unused private fields such as 'b'.
Design

Line: 46

                private SortedSet<E> sortedSet;
  private List<E> values;
  private E a;
  private E b;
  private E c;

  @Override
  public void setUp() throws Exception {
    super.setUp();

            

Reported by PMD.

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

Line: 46

                private SortedSet<E> sortedSet;
  private List<E> values;
  private E a;
  private E b;
  private E c;

  @Override
  public void setUp() throws Exception {
    super.setUp();

            

Reported by PMD.

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

Line: 47

                private List<E> values;
  private E a;
  private E b;
  private E c;

  @Override
  public void setUp() throws Exception {
    super.setUp();
    sortedSet = (SortedSet<E>) getSet();

            

Reported by PMD.

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

Line: 49

                private E b;
  private E c;

  @Override
  public void setUp() throws Exception {
    super.setUp();
    sortedSet = (SortedSet<E>) getSet();
    values =
        Helpers.copyToList(

            

Reported by PMD.

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

Line: 55

                  sortedSet = (SortedSet<E>) getSet();
    values =
        Helpers.copyToList(
            getSubjectGenerator()
                .getSampleElements(getSubjectGenerator().getCollectionSize().getNumElements()));
    Collections.sort(values, sortedSet.comparator());

    // some tests assume SEVERAL == 3
    if (values.size() >= 1) {

            

Reported by PMD.

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

Line: 56

                  values =
        Helpers.copyToList(
            getSubjectGenerator()
                .getSampleElements(getSubjectGenerator().getCollectionSize().getNumElements()));
    Collections.sort(values, sortedSet.comparator());

    // some tests assume SEVERAL == 3
    if (values.size() >= 1) {
      a = values.get(0);

            

Reported by PMD.

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

Line: 32

               * @author Nick Piepmeier
 */
public class HashingOutputStreamTest extends TestCase {
  private Hasher hasher;
  private HashFunction hashFunction;
  private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();

  @SuppressWarnings("DoNotMock")
  @Override

            

Reported by PMD.

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

Line: 33

               */
public class HashingOutputStreamTest extends TestCase {
  private Hasher hasher;
  private HashFunction hashFunction;
  private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();

  @SuppressWarnings("DoNotMock")
  @Override
  protected void setUp() throws Exception {

            

Reported by PMD.

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

Line: 34

              public class HashingOutputStreamTest extends TestCase {
  private Hasher hasher;
  private HashFunction hashFunction;
  private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();

  @SuppressWarnings("DoNotMock")
  @Override
  protected void setUp() throws Exception {
    super.setUp();

            

Reported by PMD.

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

Line: 36

                private HashFunction hashFunction;
  private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();

  @SuppressWarnings("DoNotMock")
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    hasher = mock(Hasher.class);
    hashFunction = mock(HashFunction.class);

            

Reported by PMD.

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

Line: 43

                  hasher = mock(Hasher.class);
    hashFunction = mock(HashFunction.class);

    when(hashFunction.newHasher()).thenReturn(hasher);
  }

  public void testWrite_putSingleByte() throws Exception {
    int b = 'q';
    HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);

            

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

                  when(hashFunction.newHasher()).thenReturn(hasher);
  }

  public void testWrite_putSingleByte() throws Exception {
    int b = 'q';
    HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
    out.write(b);

    verify(hashFunction).newHasher();

            

Reported by PMD.

Ensure that resources like this HashingOutputStream object are closed after use
Error

Line: 48

              
  public void testWrite_putSingleByte() throws Exception {
    int b = 'q';
    HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
    out.write(b);

    verify(hashFunction).newHasher();
    verify(hasher).putByte((byte) b);
    verifyNoMoreInteractions(hashFunction, hasher);

            

Reported by PMD.

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

Line: 51

                  HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
    out.write(b);

    verify(hashFunction).newHasher();
    verify(hasher).putByte((byte) b);
    verifyNoMoreInteractions(hashFunction, hasher);
  }

  public void testWrite_putByteArray() throws Exception {

            

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

                  verifyNoMoreInteractions(hashFunction, hasher);
  }

  public void testWrite_putByteArray() throws Exception {
    byte[] buf = new byte[] {'y', 'a', 'm', 's'};
    HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
    out.write(buf);

    verify(hashFunction).newHasher();

            

Reported by PMD.

Ensure that resources like this HashingOutputStream object are closed after use
Error

Line: 58

              
  public void testWrite_putByteArray() throws Exception {
    byte[] buf = new byte[] {'y', 'a', 'm', 's'};
    HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
    out.write(buf);

    verify(hashFunction).newHasher();
    verify(hasher).putBytes(buf, 0, buf.length);
    verifyNoMoreInteractions(hashFunction, hasher);

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/SynchronizedSetTest.java
22 issues
Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 41

               */
public class SynchronizedSetTest extends TestCase {

  public static final Object MUTEX = new Integer(1); // something Serializable

  public static Test suite() {
    return SetTestSuiteBuilder.using(
            new TestStringSetGenerator() {
              @Override

            

Reported by PMD.

This class name ends with Test but contains no test cases
Error

Line: 39

               *
 * @author Mike Bostock
 */
public class SynchronizedSetTest extends TestCase {

  public static final Object MUTEX = new Integer(1); // something Serializable

  public static Test suite() {
    return SetTestSuiteBuilder.using(

            

Reported by PMD.

JUnit 4 indicates test suites via annotations, not the suite method.
Design

Line: 43

              
  public static final Object MUTEX = new Integer(1); // something Serializable

  public static Test suite() {
    return SetTestSuiteBuilder.using(
            new TestStringSetGenerator() {
              @Override
              protected Set<String> create(String[] elements) {
                TestSet<String> inner = new TestSet<>(new HashSet<String>(), MUTEX);

            

Reported by PMD.

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

Line: 63

                      .createTestSuite();
  }

  static class TestSet<E> extends ForwardingSet<E> implements Serializable {
    final Set<E> delegate;
    public final Object mutex;

    public TestSet(Set<E> delegate, Object mutex) {
      checkNotNull(mutex);

            

Reported by PMD.

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

Line: 64

                }

  static class TestSet<E> extends ForwardingSet<E> implements Serializable {
    final Set<E> delegate;
    public final Object mutex;

    public TestSet(Set<E> delegate, Object mutex) {
      checkNotNull(mutex);
      this.delegate = delegate;

            

Reported by PMD.

Field delegate has the same name as a method
Error

Line: 64

                }

  static class TestSet<E> extends ForwardingSet<E> implements Serializable {
    final Set<E> delegate;
    public final Object mutex;

    public TestSet(Set<E> delegate, Object mutex) {
      checkNotNull(mutex);
      this.delegate = delegate;

            

Reported by PMD.

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

Line: 65

              
  static class TestSet<E> extends ForwardingSet<E> implements Serializable {
    final Set<E> delegate;
    public final Object mutex;

    public TestSet(Set<E> delegate, Object mutex) {
      checkNotNull(mutex);
      this.delegate = delegate;
      this.mutex = mutex;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 80

              
    @Override
    public String toString() {
      assertTrue(Thread.holdsLock(mutex));
      return super.toString();
    }

    @Override
    public boolean equals(@NullableDecl Object o) {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 86

              
    @Override
    public boolean equals(@NullableDecl Object o) {
      assertTrue(Thread.holdsLock(mutex));
      return super.equals(o);
    }

    @Override
    public int hashCode() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 92

              
    @Override
    public int hashCode() {
      assertTrue(Thread.holdsLock(mutex));
      return super.hashCode();
    }

    @Override
    public boolean add(@NullableDecl E o) {

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java
22 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: 32

              
  abstract Iterable<ImmutableTable<Character, Integer, String>> getTestInstances();

  public final void testClear() {
    for (Table<Character, Integer, String> testInstance : getTestInstances()) {
      try {
        testInstance.clear();
        fail();
      } catch (UnsupportedOperationException e) {

            

Reported by PMD.

In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions
Design

Line: 36

                  for (Table<Character, Integer, String> testInstance : getTestInstances()) {
      try {
        testInstance.clear();
        fail();
      } catch (UnsupportedOperationException e) {
        // success
      }
    }
  }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 36

                  for (Table<Character, Integer, String> testInstance : getTestInstances()) {
      try {
        testInstance.clear();
        fail();
      } catch (UnsupportedOperationException e) {
        // success
      }
    }
  }

            

Reported by PMD.

Avoid empty catch blocks
Error

Line: 37

                    try {
        testInstance.clear();
        fail();
      } catch (UnsupportedOperationException e) {
        // success
      }
    }
  }


            

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

                  }
  }

  public final void testPut() {
    for (Table<Character, Integer, String> testInstance : getTestInstances()) {
      try {
        testInstance.put('a', 1, "blah");
        fail();
      } catch (UnsupportedOperationException e) {

            

Reported by PMD.

In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions
Design

Line: 47

                  for (Table<Character, Integer, String> testInstance : getTestInstances()) {
      try {
        testInstance.put('a', 1, "blah");
        fail();
      } catch (UnsupportedOperationException e) {
        // success
      }
    }
  }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

                  for (Table<Character, Integer, String> testInstance : getTestInstances()) {
      try {
        testInstance.put('a', 1, "blah");
        fail();
      } catch (UnsupportedOperationException e) {
        // success
      }
    }
  }

            

Reported by PMD.

Avoid empty catch blocks
Error

Line: 48

                    try {
        testInstance.put('a', 1, "blah");
        fail();
      } catch (UnsupportedOperationException e) {
        // success
      }
    }
  }


            

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

                  }
  }

  public final void testPutAll() {
    for (Table<Character, Integer, String> testInstance : getTestInstances()) {
      try {
        testInstance.putAll(ImmutableTable.of('a', 1, "blah"));
        fail();
      } catch (UnsupportedOperationException e) {

            

Reported by PMD.

In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions
Design

Line: 58

                  for (Table<Character, Integer, String> testInstance : getTestInstances()) {
      try {
        testInstance.putAll(ImmutableTable.of('a', 1, "blah"));
        fail();
      } catch (UnsupportedOperationException e) {
        // success
      }
    }
  }

            

Reported by PMD.

android/guava-tests/test/com/google/common/graph/TestUtil.java
22 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 42

                private TestUtil() {}

  static void assertNodeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(NODE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);
  }

  static void assertEdgeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(EDGE_STRING);

            

Reported by PMD.

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

Line: 42

                private TestUtil() {}

  static void assertNodeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(NODE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);
  }

  static void assertEdgeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(EDGE_STRING);

            

Reported by PMD.

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

Line: 43

              
  static void assertNodeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(NODE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);
  }

  static void assertEdgeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(EDGE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);

            

Reported by PMD.

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

Line: 43

              
  static void assertNodeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(NODE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);
  }

  static void assertEdgeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(EDGE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);

            

Reported by PMD.

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

Line: 47

                }

  static void assertEdgeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(EDGE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);
  }

  static void assertStronglyEquivalent(Graph<?> graphA, Graph<?> graphB) {
    // Properties not covered by equals()

            

Reported by PMD.

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

Line: 47

                }

  static void assertEdgeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(EDGE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);
  }

  static void assertStronglyEquivalent(Graph<?> graphA, Graph<?> graphB) {
    // Properties not covered by equals()

            

Reported by PMD.

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

Line: 48

              
  static void assertEdgeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(EDGE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);
  }

  static void assertStronglyEquivalent(Graph<?> graphA, Graph<?> graphB) {
    // Properties not covered by equals()
    assertThat(graphA.allowsSelfLoops()).isEqualTo(graphB.allowsSelfLoops());

            

Reported by PMD.

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

Line: 48

              
  static void assertEdgeNotInGraphErrorMessage(Throwable throwable) {
    assertThat(throwable).hasMessageThat().startsWith(EDGE_STRING);
    assertThat(throwable).hasMessageThat().contains(ERROR_ELEMENT_NOT_IN_GRAPH);
  }

  static void assertStronglyEquivalent(Graph<?> graphA, Graph<?> graphB) {
    // Properties not covered by equals()
    assertThat(graphA.allowsSelfLoops()).isEqualTo(graphB.allowsSelfLoops());

            

Reported by PMD.

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

Line: 53

              
  static void assertStronglyEquivalent(Graph<?> graphA, Graph<?> graphB) {
    // Properties not covered by equals()
    assertThat(graphA.allowsSelfLoops()).isEqualTo(graphB.allowsSelfLoops());
    assertThat(graphA.nodeOrder()).isEqualTo(graphB.nodeOrder());

    assertThat(graphA).isEqualTo(graphB);
  }


            

Reported by PMD.

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

Line: 54

                static void assertStronglyEquivalent(Graph<?> graphA, Graph<?> graphB) {
    // Properties not covered by equals()
    assertThat(graphA.allowsSelfLoops()).isEqualTo(graphB.allowsSelfLoops());
    assertThat(graphA.nodeOrder()).isEqualTo(graphB.nodeOrder());

    assertThat(graphA).isEqualTo(graphB);
  }

  static void assertStronglyEquivalent(ValueGraph<?, ?> graphA, ValueGraph<?, ?> graphB) {

            

Reported by PMD.

android/guava-tests/test/com/google/common/base/CharsetsTest.java
22 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)
public class CharsetsTest extends TestCase {

  @GwtIncompatible // Non-UTF-8 Charset
  public void testUsAscii() {
    assertEquals(Charset.forName("US-ASCII"), Charsets.US_ASCII);
  }

  @GwtIncompatible // Non-UTF-8 Charset

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 35

              
  @GwtIncompatible // Non-UTF-8 Charset
  public void testUsAscii() {
    assertEquals(Charset.forName("US-ASCII"), Charsets.US_ASCII);
  }

  @GwtIncompatible // Non-UTF-8 Charset
  public void testIso88591() {
    assertEquals(Charset.forName("ISO-8859-1"), Charsets.ISO_8859_1);

            

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

                  assertEquals(Charset.forName("US-ASCII"), Charsets.US_ASCII);
  }

  @GwtIncompatible // Non-UTF-8 Charset
  public void testIso88591() {
    assertEquals(Charset.forName("ISO-8859-1"), Charsets.ISO_8859_1);
  }

  public void testUtf8() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

              
  @GwtIncompatible // Non-UTF-8 Charset
  public void testIso88591() {
    assertEquals(Charset.forName("ISO-8859-1"), Charsets.ISO_8859_1);
  }

  public void testUtf8() {
    assertEquals(Charset.forName("UTF-8"), Charsets.UTF_8);
  }

            

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

                  assertEquals(Charset.forName("ISO-8859-1"), Charsets.ISO_8859_1);
  }

  public void testUtf8() {
    assertEquals(Charset.forName("UTF-8"), Charsets.UTF_8);
  }

  @GwtIncompatible // Non-UTF-8 Charset
  public void testUtf16be() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 44

                }

  public void testUtf8() {
    assertEquals(Charset.forName("UTF-8"), Charsets.UTF_8);
  }

  @GwtIncompatible // Non-UTF-8 Charset
  public void testUtf16be() {
    assertEquals(Charset.forName("UTF-16BE"), Charsets.UTF_16BE);

            

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

                  assertEquals(Charset.forName("UTF-8"), Charsets.UTF_8);
  }

  @GwtIncompatible // Non-UTF-8 Charset
  public void testUtf16be() {
    assertEquals(Charset.forName("UTF-16BE"), Charsets.UTF_16BE);
  }

  @GwtIncompatible // Non-UTF-8 Charset

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 49

              
  @GwtIncompatible // Non-UTF-8 Charset
  public void testUtf16be() {
    assertEquals(Charset.forName("UTF-16BE"), Charsets.UTF_16BE);
  }

  @GwtIncompatible // Non-UTF-8 Charset
  public void testUtf16le() {
    assertEquals(Charset.forName("UTF-16LE"), Charsets.UTF_16LE);

            

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

                  assertEquals(Charset.forName("UTF-16BE"), Charsets.UTF_16BE);
  }

  @GwtIncompatible // Non-UTF-8 Charset
  public void testUtf16le() {
    assertEquals(Charset.forName("UTF-16LE"), Charsets.UTF_16LE);
  }

  @GwtIncompatible // Non-UTF-8 Charset

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 54

              
  @GwtIncompatible // Non-UTF-8 Charset
  public void testUtf16le() {
    assertEquals(Charset.forName("UTF-16LE"), Charsets.UTF_16LE);
  }

  @GwtIncompatible // Non-UTF-8 Charset
  public void testUtf16() {
    assertEquals(Charset.forName("UTF-16"), Charsets.UTF_16);

            

Reported by PMD.

android/guava/src/com/google/common/hash/Murmur3_128HashFunction.java
22 issues
Avoid reassigning parameters such as 'k'
Design

Line: 191

                            .array());
    }

    private static long fmix64(long k) {
      k ^= k >>> 33;
      k *= 0xff51afd7ed558ccdL;
      k ^= k >>> 33;
      k *= 0xc4ceb9fe1a85ec53L;
      k ^= k >>> 33;

            

Reported by PMD.

Avoid reassigning parameters such as 'k'
Design

Line: 191

                            .array());
    }

    private static long fmix64(long k) {
      k ^= k >>> 33;
      k *= 0xff51afd7ed558ccdL;
      k ^= k >>> 33;
      k *= 0xc4ceb9fe1a85ec53L;
      k ^= k >>> 33;

            

Reported by PMD.

Avoid reassigning parameters such as 'k'
Design

Line: 191

                            .array());
    }

    private static long fmix64(long k) {
      k ^= k >>> 33;
      k *= 0xff51afd7ed558ccdL;
      k ^= k >>> 33;
      k *= 0xc4ceb9fe1a85ec53L;
      k ^= k >>> 33;

            

Reported by PMD.

Avoid reassigning parameters such as 'k'
Design

Line: 191

                            .array());
    }

    private static long fmix64(long k) {
      k ^= k >>> 33;
      k *= 0xff51afd7ed558ccdL;
      k ^= k >>> 33;
      k *= 0xc4ceb9fe1a85ec53L;
      k ^= k >>> 33;

            

Reported by PMD.

Avoid reassigning parameters such as 'k'
Design

Line: 191

                            .array());
    }

    private static long fmix64(long k) {
      k ^= k >>> 33;
      k *= 0xff51afd7ed558ccdL;
      k ^= k >>> 33;
      k *= 0xc4ceb9fe1a85ec53L;
      k ^= k >>> 33;

            

Reported by PMD.

Avoid reassigning parameters such as 'k1'
Design

Line: 200

                    return k;
    }

    private static long mixK1(long k1) {
      k1 *= C1;
      k1 = Long.rotateLeft(k1, 31);
      k1 *= C2;
      return k1;
    }

            

Reported by PMD.

Avoid reassigning parameters such as 'k1'
Design

Line: 200

                    return k;
    }

    private static long mixK1(long k1) {
      k1 *= C1;
      k1 = Long.rotateLeft(k1, 31);
      k1 *= C2;
      return k1;
    }

            

Reported by PMD.

Avoid reassigning parameters such as 'k1'
Design

Line: 200

                    return k;
    }

    private static long mixK1(long k1) {
      k1 *= C1;
      k1 = Long.rotateLeft(k1, 31);
      k1 *= C2;
      return k1;
    }

            

Reported by PMD.

Avoid reassigning parameters such as 'k2'
Design

Line: 207

                    return k1;
    }

    private static long mixK2(long k2) {
      k2 *= C2;
      k2 = Long.rotateLeft(k2, 33);
      k2 *= C1;
      return k2;
    }

            

Reported by PMD.

Avoid reassigning parameters such as 'k2'
Design

Line: 207

                    return k1;
    }

    private static long mixK2(long k2) {
      k2 *= C2;
      k2 = Long.rotateLeft(k2, 33);
      k2 *= C1;
      return k2;
    }

            

Reported by PMD.

android/guava/src/com/google/common/collect/ForwardingTable.java
22 issues
This class has too many methods, consider refactoring it.
Design

Line: 39

              @ElementTypesAreNonnullByDefault
public abstract class ForwardingTable<
        R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object>
    extends ForwardingObject implements Table<R, C, V> {
  /** Constructor for use by subclasses. */
  protected ForwardingTable() {}

  @Override
  protected abstract Table<R, C, V> delegate();

            

Reported by PMD.

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

Line: 48

              
  @Override
  public Set<Cell<R, C, V>> cellSet() {
    return delegate().cellSet();
  }

  @Override
  public void clear() {
    delegate().clear();

            

Reported by PMD.

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

Line: 53

              
  @Override
  public void clear() {
    delegate().clear();
  }

  @Override
  public Map<R, V> column(@ParametricNullness C columnKey) {
    return delegate().column(columnKey);

            

Reported by PMD.

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

Line: 58

              
  @Override
  public Map<R, V> column(@ParametricNullness C columnKey) {
    return delegate().column(columnKey);
  }

  @Override
  public Set<C> columnKeySet() {
    return delegate().columnKeySet();

            

Reported by PMD.

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

Line: 63

              
  @Override
  public Set<C> columnKeySet() {
    return delegate().columnKeySet();
  }

  @Override
  public Map<C, Map<R, V>> columnMap() {
    return delegate().columnMap();

            

Reported by PMD.

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

Line: 68

              
  @Override
  public Map<C, Map<R, V>> columnMap() {
    return delegate().columnMap();
  }

  @Override
  public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
    return delegate().contains(rowKey, columnKey);

            

Reported by PMD.

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

Line: 73

              
  @Override
  public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
    return delegate().contains(rowKey, columnKey);
  }

  @Override
  public boolean containsColumn(@CheckForNull Object columnKey) {
    return delegate().containsColumn(columnKey);

            

Reported by PMD.

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

Line: 78

              
  @Override
  public boolean containsColumn(@CheckForNull Object columnKey) {
    return delegate().containsColumn(columnKey);
  }

  @Override
  public boolean containsRow(@CheckForNull Object rowKey) {
    return delegate().containsRow(rowKey);

            

Reported by PMD.

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

Line: 83

              
  @Override
  public boolean containsRow(@CheckForNull Object rowKey) {
    return delegate().containsRow(rowKey);
  }

  @Override
  public boolean containsValue(@CheckForNull Object value) {
    return delegate().containsValue(value);

            

Reported by PMD.

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

Line: 88

              
  @Override
  public boolean containsValue(@CheckForNull Object value) {
    return delegate().containsValue(value);
  }

  @Override
  @CheckForNull
  public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {

            

Reported by PMD.