The following issues were found

android/guava-tests/benchmark/com/google/common/util/concurrent/CycleDetectingLockFactoryBenchmark.java
7 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 33

              public class CycleDetectingLockFactoryBenchmark {

  @Param({"2", "3", "4", "5", "10"})
  int lockNestingDepth;

  CycleDetectingLockFactory factory;
  private Lock[] plainLocks;
  private Lock[] detectingLocks;


            

Reported by PMD.

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

Line: 35

                @Param({"2", "3", "4", "5", "10"})
  int lockNestingDepth;

  CycleDetectingLockFactory factory;
  private Lock[] plainLocks;
  private Lock[] detectingLocks;

  @BeforeExperiment
  void setUp() throws Exception {

            

Reported by PMD.

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

Line: 36

                int lockNestingDepth;

  CycleDetectingLockFactory factory;
  private Lock[] plainLocks;
  private Lock[] detectingLocks;

  @BeforeExperiment
  void setUp() throws Exception {
    this.factory = CycleDetectingLockFactory.newInstance(CycleDetectingLockFactory.Policies.WARN);

            

Reported by PMD.

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

Line: 37

              
  CycleDetectingLockFactory factory;
  private Lock[] plainLocks;
  private Lock[] detectingLocks;

  @BeforeExperiment
  void setUp() throws Exception {
    this.factory = CycleDetectingLockFactory.newInstance(CycleDetectingLockFactory.Policies.WARN);
    this.plainLocks = new Lock[lockNestingDepth];

            

Reported by PMD.

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

Line: 39

                private Lock[] plainLocks;
  private Lock[] detectingLocks;

  @BeforeExperiment
  void setUp() throws Exception {
    this.factory = CycleDetectingLockFactory.newInstance(CycleDetectingLockFactory.Policies.WARN);
    this.plainLocks = new Lock[lockNestingDepth];
    for (int i = 0; i < lockNestingDepth; i++) {
      plainLocks[i] = new ReentrantLock();

            

Reported by PMD.

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

Line: 40

                private Lock[] detectingLocks;

  @BeforeExperiment
  void setUp() throws Exception {
    this.factory = CycleDetectingLockFactory.newInstance(CycleDetectingLockFactory.Policies.WARN);
    this.plainLocks = new Lock[lockNestingDepth];
    for (int i = 0; i < lockNestingDepth; i++) {
      plainLocks[i] = new ReentrantLock();
    }

            

Reported by PMD.

This for loop can be replaced by a foreach loop
Design

Line: 81

              
  private static void lockAndUnlockNested(Lock[] locks, int reps) {
    for (int i = 0; i < reps; i++) {
      for (int j = 0; j < locks.length; j++) {
        locks[j].lock();
      }
      for (int j = locks.length - 1; j >= 0; j--) {
        locks[j].unlock();
      }

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/ForwardingSortedSetTest.java
7 issues
This class has too many methods, consider refactoring it.
Design

Line: 41

               * @author Louis Wasserman
 */
public class ForwardingSortedSetTest extends TestCase {
  static class StandardImplForwardingSortedSet<T> extends ForwardingSortedSet<T> {
    private final SortedSet<T> backingSortedSet;

    StandardImplForwardingSortedSet(SortedSet<T> backingSortedSet) {
      this.backingSortedSet = backingSortedSet;
    }

            

Reported by PMD.

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

Line: 42

               */
public class ForwardingSortedSetTest extends TestCase {
  static class StandardImplForwardingSortedSet<T> extends ForwardingSortedSet<T> {
    private final SortedSet<T> backingSortedSet;

    StandardImplForwardingSortedSet(SortedSet<T> backingSortedSet) {
      this.backingSortedSet = backingSortedSet;
    }


            

Reported by PMD.

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

Line: 119

                  }
  }

  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTestSuite(ForwardingSortedSetTest.class);
    suite.addTest(
        SortedSetTestSuiteBuilder.using(

            

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

                  return suite;
  }

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

            

Reported by PMD.

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

Line: 148

                }

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

            

Reported by PMD.

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

Line: 160

                          });
  }

  public void testEquals() {
    SortedSet<String> set1 = ImmutableSortedSet.of("one");
    SortedSet<String> set2 = ImmutableSortedSet.of("two");
    new EqualsTester()
        .addEqualityGroup(set1, wrap(set1), wrap(set1))
        .addEqualityGroup(set2, wrap(set2))

            

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

                          });
  }

  public void testEquals() {
    SortedSet<String> set1 = ImmutableSortedSet.of("one");
    SortedSet<String> set2 = ImmutableSortedSet.of("two");
    new EqualsTester()
        .addEqualityGroup(set1, wrap(set1), wrap(set1))
        .addEqualityGroup(set2, wrap(set2))

            

Reported by PMD.

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

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

            

Reported by PMD.

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

Line: 46

                  assertEquals(
        "A Set's hashCode() should be the sum of those of its elements.",
        expectedHashCode,
        getSet().hashCode());
  }

  @CollectionSize.Require(absent = CollectionSize.ZERO)
  @CollectionFeature.Require(ALLOWS_NULL_VALUES)
  public void testHashCode_containingNull() {

            

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

                      getSet().hashCode());
  }

  @CollectionSize.Require(absent = CollectionSize.ZERO)
  @CollectionFeature.Require(ALLOWS_NULL_VALUES)
  public void testHashCode_containingNull() {
    Collection<E> elements = getSampleElements(getNumElements() - 1);
    int expectedHashCode = 0;
    for (E element : elements) {

            

Reported by PMD.

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

Line: 58

                    expectedHashCode += ((element == null) ? 0 : element.hashCode());
    }

    elements.add(null);
    collection = getSubjectGenerator().create(elements.toArray());
    assertEquals(
        "A Set's hashCode() should be the sum of those of its elements (with "
            + "a null element counting as having a hash of zero).",
        expectedHashCode,

            

Reported by PMD.

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

Line: 59

                  }

    elements.add(null);
    collection = getSubjectGenerator().create(elements.toArray());
    assertEquals(
        "A Set's hashCode() should be the sum of those of its elements (with "
            + "a null element counting as having a hash of zero).",
        expectedHashCode,
        getSet().hashCode());

            

Reported by PMD.

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

Line: 59

                  }

    elements.add(null);
    collection = getSubjectGenerator().create(elements.toArray());
    assertEquals(
        "A Set's hashCode() should be the sum of those of its elements (with "
            + "a null element counting as having a hash of zero).",
        expectedHashCode,
        getSet().hashCode());

            

Reported by PMD.

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

Line: 64

                      "A Set's hashCode() should be the sum of those of its elements (with "
            + "a null element counting as having a hash of zero).",
        expectedHashCode,
        getSet().hashCode());
  }

  /**
   * Returns the {@link Method} instances for the test methods in this class which call {@code
   * hashCode()} on the set values so that set tests on unhashable objects can suppress it with

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/ForwardingListTest.java
7 issues
This class has too many methods, consider refactoring it.
Design

Line: 42

               * @author Louis Wasserman
 */
public class ForwardingListTest extends TestCase {
  static final class StandardImplForwardingList<T> extends ForwardingList<T> {
    private final List<T> backingList;

    StandardImplForwardingList(List<T> backingList) {
      this.backingList = backingList;
    }

            

Reported by PMD.

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

Line: 43

               */
public class ForwardingListTest extends TestCase {
  static final class StandardImplForwardingList<T> extends ForwardingList<T> {
    private final List<T> backingList;

    StandardImplForwardingList(List<T> backingList) {
      this.backingList = backingList;
    }


            

Reported by PMD.

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

Line: 155

                  }
  }

  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTestSuite(ForwardingListTest.class);
    suite.addTest(
        ListTestSuiteBuilder.using(

            

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

                  return suite;
  }

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

            

Reported by PMD.

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

Line: 191

                }

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

            

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

                          });
  }

  public void testEquals() {
    List<String> list1 = ImmutableList.of("one");
    List<String> list2 = ImmutableList.of("two");
    new EqualsTester()
        .addEqualityGroup(list1, wrap(list1), wrap(list1))
        .addEqualityGroup(list2, wrap(list2))

            

Reported by PMD.

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

Line: 203

                          });
  }

  public void testEquals() {
    List<String> list1 = ImmutableList.of("one");
    List<String> list2 = ImmutableList.of("two");
    new EqualsTester()
        .addEqualityGroup(list1, wrap(list1), wrap(list1))
        .addEqualityGroup(list2, wrap(list2))

            

Reported by PMD.

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

Line: 32

              public class ChainBenchmark {

  @Param({"1", "2", "3", "4", "5", "6"})
  int length;

  private Segment<Object, Object> segment;
  private ReferenceEntry<Object, Object> head;
  private ReferenceEntry<Object, Object> chain;


            

Reported by PMD.

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

Line: 34

                @Param({"1", "2", "3", "4", "5", "6"})
  int length;

  private Segment<Object, Object> segment;
  private ReferenceEntry<Object, Object> head;
  private ReferenceEntry<Object, Object> chain;

  @SuppressWarnings("GuardedBy")
  @BeforeExperiment

            

Reported by PMD.

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

Line: 35

                int length;

  private Segment<Object, Object> segment;
  private ReferenceEntry<Object, Object> head;
  private ReferenceEntry<Object, Object> chain;

  @SuppressWarnings("GuardedBy")
  @BeforeExperiment
  void setUp() {

            

Reported by PMD.

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

Line: 36

              
  private Segment<Object, Object> segment;
  private ReferenceEntry<Object, Object> head;
  private ReferenceEntry<Object, Object> chain;

  @SuppressWarnings("GuardedBy")
  @BeforeExperiment
  void setUp() {
    LocalCache<Object, Object> cache =

            

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 ReferenceEntry<Object, Object> head;
  private ReferenceEntry<Object, Object> chain;

  @SuppressWarnings("GuardedBy")
  @BeforeExperiment
  void setUp() {
    LocalCache<Object, Object> cache =
        new LocalCache<>(CacheBuilder.newBuilder().concurrencyLevel(1), null);
    segment = cache.segments[0];

            

Reported by PMD.

Assigning an Object to null is a code smell. Consider refactoring.
Error

Line: 44

                  LocalCache<Object, Object> cache =
        new LocalCache<>(CacheBuilder.newBuilder().concurrencyLevel(1), null);
    segment = cache.segments[0];
    chain = null;
    for (int i = 0; i < length; i++) {
      Object key = new Object();
      // TODO(b/145386688): This access should be guarded by 'this.segment', which is not currently
      // held
      chain = segment.newEntry(key, cache.hash(key), chain);

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 46

                  segment = cache.segments[0];
    chain = null;
    for (int i = 0; i < length; i++) {
      Object key = new Object();
      // TODO(b/145386688): This access should be guarded by 'this.segment', which is not currently
      // held
      chain = segment.newEntry(key, cache.hash(key), chain);
      if (i == 0) {
        head = chain;

            

Reported by PMD.

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

Line: 55

                @Override
  protected List<Class<? extends AbstractTester>> getTesters() {
    List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
    testers.add(SetMultimapAsMapTester.class);
    testers.add(SetMultimapEqualsTester.class);
    testers.add(SetMultimapPutTester.class);
    testers.add(SetMultimapPutAllTester.class);
    testers.add(SetMultimapReplaceValuesTester.class);
    testers.add(SortedSetMultimapAsMapTester.class);

            

Reported by PMD.

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

Line: 56

                protected List<Class<? extends AbstractTester>> getTesters() {
    List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
    testers.add(SetMultimapAsMapTester.class);
    testers.add(SetMultimapEqualsTester.class);
    testers.add(SetMultimapPutTester.class);
    testers.add(SetMultimapPutAllTester.class);
    testers.add(SetMultimapReplaceValuesTester.class);
    testers.add(SortedSetMultimapAsMapTester.class);
    testers.add(SortedSetMultimapGetTester.class);

            

Reported by PMD.

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

Line: 57

                  List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
    testers.add(SetMultimapAsMapTester.class);
    testers.add(SetMultimapEqualsTester.class);
    testers.add(SetMultimapPutTester.class);
    testers.add(SetMultimapPutAllTester.class);
    testers.add(SetMultimapReplaceValuesTester.class);
    testers.add(SortedSetMultimapAsMapTester.class);
    testers.add(SortedSetMultimapGetTester.class);
    return testers;

            

Reported by PMD.

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

Line: 58

                  testers.add(SetMultimapAsMapTester.class);
    testers.add(SetMultimapEqualsTester.class);
    testers.add(SetMultimapPutTester.class);
    testers.add(SetMultimapPutAllTester.class);
    testers.add(SetMultimapReplaceValuesTester.class);
    testers.add(SortedSetMultimapAsMapTester.class);
    testers.add(SortedSetMultimapGetTester.class);
    return testers;
  }

            

Reported by PMD.

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

Line: 59

                  testers.add(SetMultimapEqualsTester.class);
    testers.add(SetMultimapPutTester.class);
    testers.add(SetMultimapPutAllTester.class);
    testers.add(SetMultimapReplaceValuesTester.class);
    testers.add(SortedSetMultimapAsMapTester.class);
    testers.add(SortedSetMultimapGetTester.class);
    return testers;
  }


            

Reported by PMD.

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

Line: 60

                  testers.add(SetMultimapPutTester.class);
    testers.add(SetMultimapPutAllTester.class);
    testers.add(SetMultimapReplaceValuesTester.class);
    testers.add(SortedSetMultimapAsMapTester.class);
    testers.add(SortedSetMultimapGetTester.class);
    return testers;
  }

  @Override

            

Reported by PMD.

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

Line: 61

                  testers.add(SetMultimapPutAllTester.class);
    testers.add(SetMultimapReplaceValuesTester.class);
    testers.add(SortedSetMultimapAsMapTester.class);
    testers.add(SortedSetMultimapGetTester.class);
    return testers;
  }

  @Override
  TestSuite computeMultimapGetTestSuite(

            

Reported by PMD.

guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/InterruptibleTask.java
7 issues
A catch statement should never catch throwable since it includes errors.
Error

Line: 33

                  }
    try {
      result = runInterruptibly();
    } catch (Throwable t) {
      error = t;
    }
    if (error == null) {
      // The cast is safe because of the `run` and `error` checks.
      afterRanInterruptiblySuccess(uncheckedCastNullableTToT(result));

            

Reported by PMD.

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

Line: 46

              
  abstract boolean isDone();

  abstract T runInterruptibly() throws Exception;

  abstract void afterRanInterruptiblySuccess(T result);

  abstract void afterRanInterruptiblyFailure(Throwable error);


            

Reported by PMD.

Found 'DD'-anomaly for variable 'result' (lines '26'-'32').
Error

Line: 26

              
  @Override
  public void run() {
    T result = null;
    Throwable error = null;
    if (isDone()) {
      return;
    }
    try {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'result' (lines '26'-'42').
Error

Line: 26

              
  @Override
  public void run() {
    T result = null;
    Throwable error = null;
    if (isDone()) {
      return;
    }
    try {

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '27'-'34').
Error

Line: 27

                @Override
  public void run() {
    T result = null;
    Throwable error = null;
    if (isDone()) {
      return;
    }
    try {
      result = runInterruptibly();

            

Reported by PMD.

Found 'DU'-anomaly for variable 'error' (lines '27'-'42').
Error

Line: 27

                @Override
  public void run() {
    T result = null;
    Throwable error = null;
    if (isDone()) {
      return;
    }
    try {
      result = runInterruptibly();

            

Reported by PMD.

Found 'DU'-anomaly for variable 'result' (lines '32'-'42').
Error

Line: 32

                    return;
    }
    try {
      result = runInterruptibly();
    } catch (Throwable t) {
      error = t;
    }
    if (error == null) {
      // The cast is safe because of the `run` and `error` checks.

            

Reported by PMD.

android/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java
7 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 111

                  private static final Executor defaultAdapterExecutor =
        Executors.newCachedThreadPool(threadFactory);

    private final Executor adapterExecutor;

    // The execution list to hold our listeners.
    private final ExecutionList executionList = new ExecutionList();

    // This allows us to only start up a thread waiting on the delegate future when the first

            

Reported by PMD.

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

Line: 114

                  private final Executor adapterExecutor;

    // The execution list to hold our listeners.
    private final ExecutionList executionList = new ExecutionList();

    // This allows us to only start up a thread waiting on the delegate future when the first
    // listener is added.
    private final AtomicBoolean hasListeners = new AtomicBoolean(false);


            

Reported by PMD.

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

Line: 118

              
    // This allows us to only start up a thread waiting on the delegate future when the first
    // listener is added.
    private final AtomicBoolean hasListeners = new AtomicBoolean(false);

    // The delegate future.
    private final Future<V> delegate;

    ListenableFutureAdapter(Future<V> delegate) {

            

Reported by PMD.

Field delegate has the same name as a method
Error

Line: 121

                  private final AtomicBoolean hasListeners = new AtomicBoolean(false);

    // The delegate future.
    private final Future<V> delegate;

    ListenableFutureAdapter(Future<V> delegate) {
      this(delegate, defaultAdapterExecutor);
    }


            

Reported by PMD.

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

Line: 121

                  private final AtomicBoolean hasListeners = new AtomicBoolean(false);

    // The delegate future.
    private final Future<V> delegate;

    ListenableFutureAdapter(Future<V> delegate) {
      this(delegate, defaultAdapterExecutor);
    }


            

Reported by PMD.

A catch statement should never catch throwable since it includes errors.
Error

Line: 163

                                 * to return a proper ListenableFuture instead of using listenInPoolThread.
                   */
                  getUninterruptibly(delegate);
                } catch (Throwable e) {
                  // ExecutionException / CancellationException / RuntimeException / Error
                  // The task is presumably done, run the listeners.
                }
                executionList.execute();
              }

            

Reported by PMD.

Avoid empty catch blocks
Error

Line: 163

                                 * to return a proper ListenableFuture instead of using listenInPoolThread.
                   */
                  getUninterruptibly(delegate);
                } catch (Throwable e) {
                  // ExecutionException / CancellationException / RuntimeException / Error
                  // The task is presumably done, run the listeners.
                }
                executionList.execute();
              }

            

Reported by PMD.

android/guava/src/com/google/common/graph/MultiEdgesConnecting.java
7 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 41

              @ElementTypesAreNonnullByDefault
abstract class MultiEdgesConnecting<E> extends AbstractSet<E> {

  private final Map<E, ?> outEdgeToNode;
  private final Object targetNode;

  MultiEdgesConnecting(Map<E, ?> outEdgeToNode, Object targetNode) {
    this.outEdgeToNode = checkNotNull(outEdgeToNode);
    this.targetNode = checkNotNull(targetNode);

            

Reported by PMD.

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

Line: 42

              abstract class MultiEdgesConnecting<E> extends AbstractSet<E> {

  private final Map<E, ?> outEdgeToNode;
  private final Object targetNode;

  MultiEdgesConnecting(Map<E, ?> outEdgeToNode, Object targetNode) {
    this.outEdgeToNode = checkNotNull(outEdgeToNode);
    this.targetNode = checkNotNull(targetNode);
  }

            

Reported by PMD.

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

Line: 51

              
  @Override
  public UnmodifiableIterator<E> iterator() {
    final Iterator<? extends Entry<E, ?>> entries = outEdgeToNode.entrySet().iterator();
    return new AbstractIterator<E>() {
      @Override
      @CheckForNull
      protected E computeNext() {
        while (entries.hasNext()) {

            

Reported by PMD.

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

Line: 58

                    protected E computeNext() {
        while (entries.hasNext()) {
          Entry<E, ?> entry = entries.next();
          if (targetNode.equals(entry.getValue())) {
            return entry.getKey();
          }
        }
        return endOfData();
      }

            

Reported by PMD.

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

Line: 59

                      while (entries.hasNext()) {
          Entry<E, ?> entry = entries.next();
          if (targetNode.equals(entry.getValue())) {
            return entry.getKey();
          }
        }
        return endOfData();
      }
    };

            

Reported by PMD.

Found 'DU'-anomaly for variable 'entries' (lines '51'-'65').
Error

Line: 51

              
  @Override
  public UnmodifiableIterator<E> iterator() {
    final Iterator<? extends Entry<E, ?>> entries = outEdgeToNode.entrySet().iterator();
    return new AbstractIterator<E>() {
      @Override
      @CheckForNull
      protected E computeNext() {
        while (entries.hasNext()) {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'entries' (lines '51'-'65').
Error

Line: 51

              
  @Override
  public UnmodifiableIterator<E> iterator() {
    final Iterator<? extends Entry<E, ?>> entries = outEdgeToNode.entrySet().iterator();
    return new AbstractIterator<E>() {
      @Override
      @CheckForNull
      protected E computeNext() {
        while (entries.hasNext()) {

            

Reported by PMD.

android/guava/src/com/google/common/util/concurrent/ForwardingFuture.java
7 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 50

              
  @Override
  public boolean cancel(boolean mayInterruptIfRunning) {
    return delegate().cancel(mayInterruptIfRunning);
  }

  @Override
  public boolean isCancelled() {
    return delegate().isCancelled();

            

Reported by PMD.

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

Line: 55

              
  @Override
  public boolean isCancelled() {
    return delegate().isCancelled();
  }

  @Override
  public boolean isDone() {
    return delegate().isDone();

            

Reported by PMD.

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

Line: 60

              
  @Override
  public boolean isDone() {
    return delegate().isDone();
  }

  @Override
  @ParametricNullness
  public V get() throws InterruptedException, ExecutionException {

            

Reported by PMD.

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

Line: 66

                @Override
  @ParametricNullness
  public V get() throws InterruptedException, ExecutionException {
    return delegate().get();
  }

  @Override
  @ParametricNullness
  public V get(long timeout, TimeUnit unit)

            

Reported by PMD.

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

Line: 73

                @ParametricNullness
  public V get(long timeout, TimeUnit unit)
      throws InterruptedException, ExecutionException, TimeoutException {
    return delegate().get(timeout, unit);
  }

  // TODO(cpovirk): Use standard Javadoc form for SimpleForwarding* class and constructor
  /**
   * A simplified version of {@link ForwardingFuture} where subclasses can pass in an already

            

Reported by PMD.

Field delegate has the same name as a method
Error

Line: 85

                 */
  public abstract static class SimpleForwardingFuture<V extends @Nullable Object>
      extends ForwardingFuture<V> {
    private final Future<V> delegate;

    protected SimpleForwardingFuture(Future<V> delegate) {
      this.delegate = Preconditions.checkNotNull(delegate);
    }


            

Reported by PMD.

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

Line: 85

                 */
  public abstract static class SimpleForwardingFuture<V extends @Nullable Object>
      extends ForwardingFuture<V> {
    private final Future<V> delegate;

    protected SimpleForwardingFuture(Future<V> delegate) {
      this.delegate = Preconditions.checkNotNull(delegate);
    }


            

Reported by PMD.