The following issues were found

android/guava/src/com/google/common/collect/AbstractMapEntry.java
4 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 54

                public boolean equals(@CheckForNull Object object) {
    if (object instanceof Entry) {
      Entry<?, ?> that = (Entry<?, ?>) object;
      return Objects.equal(this.getKey(), that.getKey())
          && Objects.equal(this.getValue(), that.getValue());
    }
    return false;
  }


            

Reported by PMD.

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

Line: 55

                  if (object instanceof Entry) {
      Entry<?, ?> that = (Entry<?, ?>) object;
      return Objects.equal(this.getKey(), that.getKey())
          && Objects.equal(this.getValue(), that.getValue());
    }
    return false;
  }

  @Override

            

Reported by PMD.

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

Line: 64

                public int hashCode() {
    K k = getKey();
    V v = getValue();
    return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode());
  }

  /** Returns a string representation of the form {@code {key}={value}}. */
  @Override
  public String toString() {

            

Reported by PMD.

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

Line: 64

                public int hashCode() {
    K k = getKey();
    V v = getValue();
    return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode());
  }

  /** Returns a string representation of the form {@code {key}={value}}. */
  @Override
  public String toString() {

            

Reported by PMD.

android/guava/src/com/google/common/collect/CompactHashing.java
4 issues
Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 166

                    Object table,
      int[] entries,
      @Nullable Object[] keys,
      @CheckForNull @Nullable Object[] values) {
    int hash = Hashing.smearedHash(key);
    int tableIndex = hash & mask;
    int next = tableGet(table, tableIndex);
    if (next == UNSET) {
      return -1;

            

Reported by PMD.

Found 'DD'-anomaly for variable 'lastEntryIndex' (lines '174'-'192').
Error

Line: 174

                    return -1;
    }
    int hashPrefix = getHashPrefix(hash, mask);
    int lastEntryIndex = -1;
    do {
      int entryIndex = next - 1;
      int entry = entries[entryIndex];
      if (getHashPrefix(entry, mask) == hashPrefix
          && Objects.equal(key, keys[entryIndex])

            

Reported by PMD.

Found 'DD'-anomaly for variable 'lastEntryIndex' (lines '192'-'192').
Error

Line: 192

              
        return entryIndex;
      }
      lastEntryIndex = entryIndex;
      next = getNext(entry, mask);
    } while (next != UNSET);
    return -1;
  }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'lastEntryIndex' (lines '192'-'196').
Error

Line: 192

              
        return entryIndex;
      }
      lastEntryIndex = entryIndex;
      next = getNext(entry, mask);
    } while (next != UNSET);
    return -1;
  }
}

            

Reported by PMD.

android/guava/src/com/google/common/collect/CompactLinkedHashMap.java
4 issues
Classes implementing Serializable should set a serialVersionUID
Error

Line: 52

               */
@GwtIncompatible // not worth using in GWT for now
@ElementTypesAreNonnullByDefault
class CompactLinkedHashMap<K extends @Nullable Object, V extends @Nullable Object>
    extends CompactHashMap<K, V> {
  // TODO(lowasser): implement removeEldestEntry so this can be used as a drop-in replacement

  /** Creates an empty {@code CompactLinkedHashMap} instance. */
  public static <K extends @Nullable Object, V extends @Nullable Object>

            

Reported by PMD.

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

Line: 53

              @GwtIncompatible // not worth using in GWT for now
@ElementTypesAreNonnullByDefault
class CompactLinkedHashMap<K extends @Nullable Object, V extends @Nullable Object>
    extends CompactHashMap<K, V> {
  // TODO(lowasser): implement removeEldestEntry so this can be used as a drop-in replacement

  /** Creates an empty {@code CompactLinkedHashMap} instance. */
  public static <K extends @Nullable Object, V extends @Nullable Object>
      CompactLinkedHashMap<K, V> create() {

            

Reported by PMD.

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

Line: 95

                /** Pointer to the last node in the linked list, or {@code ENDPOINT} if there are no entries. */
  private transient int lastEntry;

  private final boolean accessOrder;

  CompactLinkedHashMap() {
    this(CompactHashing.DEFAULT_SIZE);
  }


            

Reported by PMD.

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

Line: 133

                @CanIgnoreReturnValue
  Map<K, V> convertToHashFloodingResistantImplementation() {
    Map<K, V> result = super.convertToHashFloodingResistantImplementation();
    links = null;
    return result;
  }

  /*
   * For discussion of the safety of the following methods for operating on predecessors and

            

Reported by PMD.

android/guava/src/com/google/common/collect/Comparators.java
4 issues
Found 'DU'-anomaly for variable 'prev' (lines '77'-'87').
Error

Line: 77

                  checkNotNull(comparator);
    Iterator<? extends T> it = iterable.iterator();
    if (it.hasNext()) {
      T prev = it.next();
      while (it.hasNext()) {
        T next = it.next();
        if (comparator.compare(prev, next) > 0) {
          return false;
        }

            

Reported by PMD.

Found 'DU'-anomaly for variable 'prev' (lines '83'-'87').
Error

Line: 83

                      if (comparator.compare(prev, next) > 0) {
          return false;
        }
        prev = next;
      }
    }
    return true;
  }


            

Reported by PMD.

Found 'DU'-anomaly for variable 'prev' (lines '99'-'109').
Error

Line: 99

                  checkNotNull(comparator);
    Iterator<? extends T> it = iterable.iterator();
    if (it.hasNext()) {
      T prev = it.next();
      while (it.hasNext()) {
        T next = it.next();
        if (comparator.compare(prev, next) >= 0) {
          return false;
        }

            

Reported by PMD.

Found 'DU'-anomaly for variable 'prev' (lines '105'-'109').
Error

Line: 105

                      if (comparator.compare(prev, next) >= 0) {
          return false;
        }
        prev = next;
      }
    }
    return true;
  }


            

Reported by PMD.

android/guava/src/com/google/common/collect/EvictingQueue.java
4 issues
Field delegate has the same name as a method
Error

Line: 51

              @ElementTypesAreNonnullByDefault
public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serializable {

  private final Queue<E> delegate;

  @VisibleForTesting final int maxSize;

  private EvictingQueue(int maxSize) {
    checkArgument(maxSize >= 0, "maxSize (%s) must >= 0", maxSize);

            

Reported by PMD.

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

Line: 51

              @ElementTypesAreNonnullByDefault
public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serializable {

  private final Queue<E> delegate;

  @VisibleForTesting final int maxSize;

  private EvictingQueue(int maxSize) {
    checkArgument(maxSize >= 0, "maxSize (%s) must >= 0", maxSize);

            

Reported by PMD.

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

Line: 53

              
  private final Queue<E> delegate;

  @VisibleForTesting final int maxSize;

  private EvictingQueue(int maxSize) {
    checkArgument(maxSize >= 0, "maxSize (%s) must >= 0", maxSize);
    this.delegate = new ArrayDeque<E>(maxSize);
    this.maxSize = maxSize;

            

Reported by PMD.

Overriding method merely calls super
Design

Line: 130

                }

  @Override
  public Object[] toArray() {
    /*
     * If we could, we'd declare the no-arg `Collection.toArray()` to return "Object[] but elements
     * have the same nullness as E." Since we can't, we declare it to return nullable elements, and
     * we can override it in our non-null-guaranteeing subtypes to present a better signature to
     * their users.

            

Reported by PMD.

android/guava/src/com/google/common/collect/ForwardingConcurrentMap.java
4 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 54

                @Override
  @CheckForNull
  public V putIfAbsent(K key, V value) {
    return delegate().putIfAbsent(key, value);
  }

  @CanIgnoreReturnValue
  @Override
  public boolean remove(@CheckForNull Object key, @CheckForNull Object value) {

            

Reported by PMD.

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

Line: 60

                @CanIgnoreReturnValue
  @Override
  public boolean remove(@CheckForNull Object key, @CheckForNull Object value) {
    return delegate().remove(key, value);
  }

  @CanIgnoreReturnValue
  @Override
  @CheckForNull

            

Reported by PMD.

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

Line: 67

                @Override
  @CheckForNull
  public V replace(K key, V value) {
    return delegate().replace(key, value);
  }

  @CanIgnoreReturnValue
  @Override
  public boolean replace(K key, V oldValue, V newValue) {

            

Reported by PMD.

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

Line: 73

                @CanIgnoreReturnValue
  @Override
  public boolean replace(K key, V oldValue, V newValue) {
    return delegate().replace(key, oldValue, newValue);
  }
}

            

Reported by PMD.

android/guava/src/com/google/common/collect/ForwardingSetMultimap.java
4 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 48

              
  @Override
  public Set<Entry<K, V>> entries() {
    return delegate().entries();
  }

  @Override
  public Set<V> get(@ParametricNullness K key) {
    return delegate().get(key);

            

Reported by PMD.

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

Line: 53

              
  @Override
  public Set<V> get(@ParametricNullness K key) {
    return delegate().get(key);
  }

  @CanIgnoreReturnValue
  @Override
  public Set<V> removeAll(@CheckForNull Object key) {

            

Reported by PMD.

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

Line: 59

                @CanIgnoreReturnValue
  @Override
  public Set<V> removeAll(@CheckForNull Object key) {
    return delegate().removeAll(key);
  }

  @CanIgnoreReturnValue
  @Override
  public Set<V> replaceValues(@ParametricNullness K key, Iterable<? extends V> values) {

            

Reported by PMD.

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

Line: 65

                @CanIgnoreReturnValue
  @Override
  public Set<V> replaceValues(@ParametricNullness K key, Iterable<? extends V> values) {
    return delegate().replaceValues(key, values);
  }
}

            

Reported by PMD.

android/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java
4 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 51

              
  @Override
  public SortedSet<V> get(@ParametricNullness K key) {
    return delegate().get(key);
  }

  @Override
  public SortedSet<V> removeAll(@CheckForNull Object key) {
    return delegate().removeAll(key);

            

Reported by PMD.

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

Line: 56

              
  @Override
  public SortedSet<V> removeAll(@CheckForNull Object key) {
    return delegate().removeAll(key);
  }

  @Override
  public SortedSet<V> replaceValues(@ParametricNullness K key, Iterable<? extends V> values) {
    return delegate().replaceValues(key, values);

            

Reported by PMD.

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

Line: 61

              
  @Override
  public SortedSet<V> replaceValues(@ParametricNullness K key, Iterable<? extends V> values) {
    return delegate().replaceValues(key, values);
  }

  @Override
  @CheckForNull
  public Comparator<? super V> valueComparator() {

            

Reported by PMD.

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

Line: 67

                @Override
  @CheckForNull
  public Comparator<? super V> valueComparator() {
    return delegate().valueComparator();
  }
}

            

Reported by PMD.

android/guava/src/com/google/common/collect/ImmutableAsList.java
4 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 43

                public boolean contains(@CheckForNull Object target) {
    // The collection's contains() is at least as fast as ImmutableList's
    // and is often faster.
    return delegateCollection().contains(target);
  }

  @Override
  public int size() {
    return delegateCollection().size();

            

Reported by PMD.

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

Line: 48

              
  @Override
  public int size() {
    return delegateCollection().size();
  }

  @Override
  public boolean isEmpty() {
    return delegateCollection().isEmpty();

            

Reported by PMD.

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

Line: 53

              
  @Override
  public boolean isEmpty() {
    return delegateCollection().isEmpty();
  }

  @Override
  boolean isPartialView() {
    return delegateCollection().isPartialView();

            

Reported by PMD.

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

Line: 58

              
  @Override
  boolean isPartialView() {
    return delegateCollection().isPartialView();
  }

  /** Serialized form that leads to the same performance as the original list. */
  @GwtIncompatible // serialization
  static class SerializedForm implements Serializable {

            

Reported by PMD.

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

Line: 46

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Queues {
  private Queues() {}

  // ArrayBlockingQueue

  /**

            

Reported by PMD.

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

Line: 359

                    }
    } finally {
      if (interrupted) {
        Thread.currentThread().interrupt();
      }
    }
    return added;
  }


            

Reported by PMD.

Found 'DU'-anomaly for variable 'deadline' (lines '290'-'306').
Error

Line: 290

                   * execute Queue#drainTo is not added *on top* of waiting for the timeout (which could make
     * the timeout arbitrarily inaccurate, given a queue that is slow to drain).
     */
    long deadline = System.nanoTime() + unit.toNanos(timeout);
    int added = 0;
    while (added < numElements) {
      // we could rely solely on #poll, but #drainTo might be more efficient when there are multiple
      // elements already available (e.g. LinkedBlockingQueue#drainTo locks only once)
      added += q.drainTo(buffer, numElements - added);

            

Reported by PMD.

Found 'DU'-anomaly for variable 'deadline' (lines '332'-'363').
Error

Line: 332

                    long timeout,
      TimeUnit unit) {
    Preconditions.checkNotNull(buffer);
    long deadline = System.nanoTime() + unit.toNanos(timeout);
    int added = 0;
    boolean interrupted = false;
    try {
      while (added < numElements) {
        // we could rely solely on #poll, but #drainTo might be more efficient when there are

            

Reported by PMD.