The following issues were found

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

Line: 39

              
  @Override
  protected Map<String, Collection<Integer>> makeEmptyMap() {
    return ImmutableSetMultimap.<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 ImmutableSetMultimap.<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 ImmutableSetMultimap.copyOf(delegate).asMap();
  }
}

            

Reported by PMD.

android/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.

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

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListMultimapReplaceValuesTester<K, V> extends AbstractListMultimapTester<K, V> {
  @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
  public void testReplaceValuesPreservesOrder() {
    @SuppressWarnings("unchecked")
    List<V> values = Arrays.asList(v3(), v1(), v4());

    for (K k : sampleKeys()) {

            

Reported by PMD.

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

Line: 42

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

            

Reported by PMD.

Found 'DU'-anomaly for variable 'values' (lines '38'-'45').
Error

Line: 38

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

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

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapEqualsTester.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 ListMultimapEqualsTester<K, V> extends AbstractListMultimapTester<K, V> {
  @CollectionSize.Require(SEVERAL)
  public void testOrderingAffectsEqualsComparisons() {
    ListMultimap<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 testOrderingAffectsEqualsComparisons() {
    ListMultimap<K, V> multimap1 =
        getSubjectGenerator()
            .create(
                Helpers.mapEntry(k0(), v0()),
                Helpers.mapEntry(k0(), v1()),
                Helpers.mapEntry(k0(), v0()));
    ListMultimap<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(), v0()));
    ListMultimap<K, V> multimap2 =
        getSubjectGenerator()
            .create(
                Helpers.mapEntry(k0(), v1()),
                Helpers.mapEntry(k0(), v0()),
                Helpers.mapEntry(k0(), v0()));
    new EqualsTester().addEqualityGroup(multimap1).addEqualityGroup(multimap2).testEquals();

            

Reported by PMD.

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

Line: 109

                          .withSetUp(parentBuilder.getSetUp())
            .withTearDown(parentBuilder.getTearDown())
            .createTestSuite());
    if (!parentBuilder.getFeatures().contains(NoRecurse.INVERSE)) {
      derived.add(
          BiMapTestSuiteBuilder.using(
                  new InverseBiMapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
              .withFeatures(computeInverseFeatures(parentBuilder.getFeatures()))
              .named(parentBuilder.getName() + " inverse")

            

Reported by PMD.

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

Line: 148

              
  private static Set<Feature<?>> computeValuesSetFeatures(Set<Feature<?>> mapFeatures) {
    Set<Feature<?>> valuesCollectionFeatures = computeCommonDerivedCollectionFeatures(mapFeatures);
    valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_QUERIES);

    if (mapFeatures.contains(MapFeature.ALLOWS_NULL_VALUES)) {
      valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_VALUES);
    }


            

Reported by PMD.

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

Line: 154

                    valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_VALUES);
    }

    valuesCollectionFeatures.add(CollectionFeature.REJECTS_DUPLICATES_AT_CREATION);

    return valuesCollectionFeatures;
  }

  private static Set<Feature<?>> computeCommonDerivedCollectionFeatures(

            

Reported by PMD.

android/guava-tests/test/com/google/common/eventbus/PackageSanityTests.java
3 issues
A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 31

              
public class PackageSanityTests extends AbstractPackageSanityTests {

  public PackageSanityTests() throws Exception {
    DummySubscriber dummySubscriber = new DummySubscriber();
    setDefault(Subscriber.class, dummySubscriber.toSubscriber());
    setDefault(Method.class, DummySubscriber.subscriberMethod());
    setDefault(SubscriberExceptionContext.class, dummySubscriber.toContext());
    setDefault(Dispatcher.class, Dispatcher.immediate());

            

Reported by PMD.

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

Line: 41

              
  private static class DummySubscriber {

    private final EventBus eventBus = new EventBus();

    @Subscribe
    public void handle(@NullableDecl Object anything) {}

    Subscriber toSubscriber() throws Exception {

            

Reported by PMD.

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

Line: 46

                  @Subscribe
    public void handle(@NullableDecl Object anything) {}

    Subscriber toSubscriber() throws Exception {
      return Subscriber.create(eventBus, this, subscriberMethod());
    }

    SubscriberExceptionContext toContext() {
      return new SubscriberExceptionContext(eventBus, new Object(), this, subscriberMethod());

            

Reported by PMD.

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

Line: 32

               */
@GwtCompatible
public abstract class TestMapEntrySetGenerator<K, V> implements TestSetGenerator<Map.Entry<K, V>> {
  private final SampleElements<K> keys;
  private final SampleElements<V> values;

  protected TestMapEntrySetGenerator(SampleElements<K> keys, SampleElements<V> values) {
    this.keys = keys;
    this.values = values;

            

Reported by PMD.

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

Line: 33

              @GwtCompatible
public abstract class TestMapEntrySetGenerator<K, V> implements TestSetGenerator<Map.Entry<K, V>> {
  private final SampleElements<K> keys;
  private final SampleElements<V> values;

  protected TestMapEntrySetGenerator(SampleElements<K> keys, SampleElements<V> values) {
    this.keys = keys;
    this.values = values;
  }

            

Reported by PMD.

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

Line: 52

                  return createFromEntries(entries);
  }

  public abstract Set<Entry<K, V>> createFromEntries(Entry<K, V>[] entries);

  @Override
  @SuppressWarnings("unchecked") // generic arrays make typesafety sad
  public Entry<K, V>[] createArray(int length) {
    return new Entry[length];

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java
3 issues
This class has too many methods, consider refactoring it.
Design

Line: 35

               * @author Louis Wasserman
 */
@GwtIncompatible
public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> {
  @SuppressWarnings("unchecked")
  private static final Comparator<Object> NATURAL_ORDER =
      new Comparator<Object>() {
        @Override
        public int compare(Object o1, Object o2) {

            

Reported by PMD.

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

Line: 45

                      }
      };

  private final NavigableSet<E> delegate;

  public SafeTreeSet() {
    this(new TreeSet<E>());
  }


            

Reported by PMD.

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

Line: 235

                  // a ClassCastException is what's supposed to happen!
    @SuppressWarnings("unchecked")
    E e = (E) t;
    comparator().compare(e, e);
    return t;
  }

  @Override
  public boolean equals(Object obj) {

            

Reported by PMD.

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

Line: 32

              public class TestByteSink extends ByteSink implements TestStreamSupplier {

  private final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  private final ImmutableSet<TestOption> options;

  private boolean outputStreamOpened;
  private boolean outputStreamClosed;

  public TestByteSink(TestOption... options) {

            

Reported by PMD.

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

Line: 34

                private final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  private final ImmutableSet<TestOption> options;

  private boolean outputStreamOpened;
  private boolean outputStreamClosed;

  public TestByteSink(TestOption... options) {
    this.options = ImmutableSet.copyOf(options);
  }

            

Reported by PMD.

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

Line: 35

                private final ImmutableSet<TestOption> options;

  private boolean outputStreamOpened;
  private boolean outputStreamClosed;

  public TestByteSink(TestOption... options) {
    this.options = ImmutableSet.copyOf(options);
  }


            

Reported by PMD.

android/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.

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.

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.