The following issues were found

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

Line: 48

              @GwtCompatible
@ElementTypesAreNonnullByDefault
abstract class AbstractMultiset<E extends @Nullable Object> extends AbstractCollection<E>
    implements Multiset<E> {
  // Query Operations

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

            

Reported by PMD.

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

Line: 53

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

  @Override
  public boolean contains(@CheckForNull Object element) {
    return count(element) > 0;

            

Reported by PMD.

Field elementSet has the same name as a method
Error

Line: 130

              
  // Views

  @LazyInit @CheckForNull private transient Set<E> elementSet;

  @Override
  public Set<E> elementSet() {
    Set<E> result = elementSet;
    if (result == null) {

            

Reported by PMD.

Field entrySet has the same name as a method
Error

Line: 164

              
  abstract Iterator<E> elementIterator();

  @LazyInit @CheckForNull private transient Set<Entry<E>> entrySet;

  @Override
  public Set<Entry<E>> entrySet() {
    Set<Entry<E>> result = entrySet;
    if (result == null) {

            

Reported by PMD.

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

Line: 221

                 */
  @Override
  public final int hashCode() {
    return entrySet().hashCode();
  }

  /**
   * {@inheritDoc}
   *

            

Reported by PMD.

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

Line: 232

                 */
  @Override
  public final String toString() {
    return entrySet().toString();
  }
}

            

Reported by PMD.

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

Line: 38

              @GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class AbstractNavigableMap<K extends @Nullable Object, V extends @Nullable Object>
    extends IteratorBasedAbstractMap<K, V> implements NavigableMap<K, V> {

  @Override
  @CheckForNull
  public abstract V get(@CheckForNull Object key);


            

Reported by PMD.

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

Line: 93

                @Override
  @CheckForNull
  public Entry<K, V> lowerEntry(@ParametricNullness K key) {
    return headMap(key, false).lastEntry();
  }

  @Override
  @CheckForNull
  public Entry<K, V> floorEntry(@ParametricNullness K key) {

            

Reported by PMD.

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

Line: 99

                @Override
  @CheckForNull
  public Entry<K, V> floorEntry(@ParametricNullness K key) {
    return headMap(key, true).lastEntry();
  }

  @Override
  @CheckForNull
  public Entry<K, V> ceilingEntry(@ParametricNullness K key) {

            

Reported by PMD.

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

Line: 105

                @Override
  @CheckForNull
  public Entry<K, V> ceilingEntry(@ParametricNullness K key) {
    return tailMap(key, true).firstEntry();
  }

  @Override
  @CheckForNull
  public Entry<K, V> higherEntry(@ParametricNullness K key) {

            

Reported by PMD.

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

Line: 111

                @Override
  @CheckForNull
  public Entry<K, V> higherEntry(@ParametricNullness K key) {
    return tailMap(key, false).firstEntry();
  }

  @Override
  @CheckForNull
  public K lowerKey(@ParametricNullness K key) {

            

Reported by PMD.

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

Line: 167

              
  @Override
  public NavigableSet<K> descendingKeySet() {
    return descendingMap().navigableKeySet();
  }

  @Override
  public NavigableMap<K, V> descendingMap() {
    return new DescendingMap();

            

Reported by PMD.

android/guava/src/com/google/common/io/CharSequenceReader.java
6 issues
This class has too many methods, consider refactoring it.
Design

Line: 37

              // TODO(cgdecker): make this public? as a type, or a method in CharStreams?
@GwtIncompatible
@ElementTypesAreNonnullByDefault
final class CharSequenceReader extends Reader {

  @CheckForNull private CharSequence seq;
  private int pos;
  private int mark;


            

Reported by PMD.

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

Line: 39

              @ElementTypesAreNonnullByDefault
final class CharSequenceReader extends Reader {

  @CheckForNull private CharSequence seq;
  private int pos;
  private int mark;

  /** Creates a new reader wrapping the given character sequence. */
  public CharSequenceReader(CharSequence seq) {

            

Reported by PMD.

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

Line: 40

              final class CharSequenceReader extends Reader {

  @CheckForNull private CharSequence seq;
  private int pos;
  private int mark;

  /** Creates a new reader wrapping the given character sequence. */
  public CharSequenceReader(CharSequence seq) {
    this.seq = checkNotNull(seq);

            

Reported by PMD.

Field mark has the same name as a method
Error

Line: 41

              
  @CheckForNull private CharSequence seq;
  private int pos;
  private int mark;

  /** Creates a new reader wrapping the given character sequence. */
  public CharSequenceReader(CharSequence seq) {
    this.seq = checkNotNull(seq);
  }

            

Reported by PMD.

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

Line: 41

              
  @CheckForNull private CharSequence seq;
  private int pos;
  private int mark;

  /** Creates a new reader wrapping the given character sequence. */
  public CharSequenceReader(CharSequence seq) {
    this.seq = checkNotNull(seq);
  }

            

Reported by PMD.

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

Line: 147

              
  @Override
  public synchronized void close() throws IOException {
    seq = null;
  }
}

            

Reported by PMD.

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

Line: 27

               */
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class AbstractRangeSet<C extends Comparable> implements RangeSet<C> {
  AbstractRangeSet() {}

  @Override
  public boolean contains(C value) {
    return rangeContaining(value) != null;

            

Reported by PMD.

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

Line: 41

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

  @Override
  public void add(Range<C> range) {
    throw new UnsupportedOperationException();

            

Reported by PMD.

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

Line: 100

              
  @Override
  public boolean intersects(Range<C> otherRange) {
    return !subRangeSet(otherRange).isEmpty();
  }

  @Override
  public abstract boolean encloses(Range<C> otherRange);


            

Reported by PMD.

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

Line: 112

                    return true;
    } else if (obj instanceof RangeSet) {
      RangeSet<?> other = (RangeSet<?>) obj;
      return this.asRanges().equals(other.asRanges());
    }
    return false;
  }

  @Override

            

Reported by PMD.

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

Line: 119

              
  @Override
  public final int hashCode() {
    return asRanges().hashCode();
  }

  @Override
  public final String toString() {
    return asRanges().toString();

            

Reported by PMD.

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

Line: 124

              
  @Override
  public final String toString() {
    return asRanges().toString();
  }
}

            

Reported by PMD.

android/guava/src/com/google/common/graph/AbstractGraph.java
6 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 44

                  }
    Graph<?> other = (Graph<?>) obj;

    return isDirected() == other.isDirected()
        && nodes().equals(other.nodes())
        && edges().equals(other.edges());
  }

  @Override

            

Reported by PMD.

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

Line: 45

                  Graph<?> other = (Graph<?>) obj;

    return isDirected() == other.isDirected()
        && nodes().equals(other.nodes())
        && edges().equals(other.edges());
  }

  @Override
  public final int hashCode() {

            

Reported by PMD.

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

Line: 45

                  Graph<?> other = (Graph<?>) obj;

    return isDirected() == other.isDirected()
        && nodes().equals(other.nodes())
        && edges().equals(other.edges());
  }

  @Override
  public final int hashCode() {

            

Reported by PMD.

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

Line: 46

              
    return isDirected() == other.isDirected()
        && nodes().equals(other.nodes())
        && edges().equals(other.edges());
  }

  @Override
  public final int hashCode() {
    return edges().hashCode();

            

Reported by PMD.

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

Line: 46

              
    return isDirected() == other.isDirected()
        && nodes().equals(other.nodes())
        && edges().equals(other.edges());
  }

  @Override
  public final int hashCode() {
    return edges().hashCode();

            

Reported by PMD.

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

Line: 51

              
  @Override
  public final int hashCode() {
    return edges().hashCode();
  }

  /** Returns a string representation of this graph. */
  @Override
  public String toString() {

            

Reported by PMD.

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

Line: 59

              
  @Override
  public ImmutableSortedSet<E> elementSet() {
    return forward.elementSet().descendingSet();
  }

  @Override
  Entry<E> getEntry(int index) {
    return forward.entrySet().asList().reverse().get(index);

            

Reported by PMD.

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

Line: 64

              
  @Override
  Entry<E> getEntry(int index) {
    return forward.entrySet().asList().reverse().get(index);
  }

  @Override
  public ImmutableSortedMultiset<E> descendingMultiset() {
    return forward;

            

Reported by PMD.

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

Line: 64

              
  @Override
  Entry<E> getEntry(int index) {
    return forward.entrySet().asList().reverse().get(index);
  }

  @Override
  public ImmutableSortedMultiset<E> descendingMultiset() {
    return forward;

            

Reported by PMD.

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

Line: 64

              
  @Override
  Entry<E> getEntry(int index) {
    return forward.entrySet().asList().reverse().get(index);
  }

  @Override
  public ImmutableSortedMultiset<E> descendingMultiset() {
    return forward;

            

Reported by PMD.

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

Line: 74

              
  @Override
  public ImmutableSortedMultiset<E> headMultiset(E upperBound, BoundType boundType) {
    return forward.tailMultiset(upperBound, boundType).descendingMultiset();
  }

  @Override
  public ImmutableSortedMultiset<E> tailMultiset(E lowerBound, BoundType boundType) {
    return forward.headMultiset(lowerBound, boundType).descendingMultiset();

            

Reported by PMD.

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

Line: 79

              
  @Override
  public ImmutableSortedMultiset<E> tailMultiset(E lowerBound, BoundType boundType) {
    return forward.headMultiset(lowerBound, boundType).descendingMultiset();
  }

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

            

Reported by PMD.

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

Line: 29

               */
@GwtIncompatible
@ElementTypesAreNonnullByDefault
final class DescendingImmutableSortedSet<E> extends ImmutableSortedSet<E> {
  private final ImmutableSortedSet<E> forward;

  DescendingImmutableSortedSet(ImmutableSortedSet<E> forward) {
    super(Ordering.from(forward.comparator()).reverse());
    this.forward = forward;

            

Reported by PMD.

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

Line: 29

               */
@GwtIncompatible
@ElementTypesAreNonnullByDefault
final class DescendingImmutableSortedSet<E> extends ImmutableSortedSet<E> {
  private final ImmutableSortedSet<E> forward;

  DescendingImmutableSortedSet(ImmutableSortedSet<E> forward) {
    super(Ordering.from(forward.comparator()).reverse());
    this.forward = forward;

            

Reported by PMD.

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

Line: 30

              @GwtIncompatible
@ElementTypesAreNonnullByDefault
final class DescendingImmutableSortedSet<E> extends ImmutableSortedSet<E> {
  private final ImmutableSortedSet<E> forward;

  DescendingImmutableSortedSet(ImmutableSortedSet<E> forward) {
    super(Ordering.from(forward.comparator()).reverse());
    this.forward = forward;
  }

            

Reported by PMD.

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

Line: 54

              
  @Override
  ImmutableSortedSet<E> headSetImpl(E toElement, boolean inclusive) {
    return forward.tailSet(toElement, inclusive).descendingSet();
  }

  @Override
  ImmutableSortedSet<E> subSetImpl(
      E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {

            

Reported by PMD.

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

Line: 60

                @Override
  ImmutableSortedSet<E> subSetImpl(
      E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) {
    return forward.subSet(toElement, toInclusive, fromElement, fromInclusive).descendingSet();
  }

  @Override
  ImmutableSortedSet<E> tailSetImpl(E fromElement, boolean inclusive) {
    return forward.headSet(fromElement, inclusive).descendingSet();

            

Reported by PMD.

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

Line: 65

              
  @Override
  ImmutableSortedSet<E> tailSetImpl(E fromElement, boolean inclusive) {
    return forward.headSet(fromElement, inclusive).descendingSet();
  }

  @Override
  @GwtIncompatible("NavigableSet")
  public ImmutableSortedSet<E> descendingSet() {

            

Reported by PMD.

android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java
6 issues
Returning 'replacementArray' may expose an internal array.
Design

Line: 63

              
  // Returns the non-null array of replacements for fast lookup.
  char[][] getReplacementArray() {
    return replacementArray;
  }

  // Creates a replacement array from the given map. The returned array is a
  // linear lookup table of replacement character sequences indexed by the
  // original character value.

            

Reported by PMD.

Returning 'EMPTY_REPLACEMENT_ARRAY' may expose an internal array.
Design

Line: 73

                static char[][] createReplacementArray(Map<Character, String> map) {
    checkNotNull(map); // GWT specific check (do not optimize)
    if (map.isEmpty()) {
      return EMPTY_REPLACEMENT_ARRAY;
    }
    char max = Collections.max(map.keySet());
    char[][] replacements = new char[max + 1][];
    for (Character c : map.keySet()) {
      replacements[c] = map.get(c).toCharArray();

            

Reported by PMD.

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

Line: 78

                  char max = Collections.max(map.keySet());
    char[][] replacements = new char[max + 1][];
    for (Character c : map.keySet()) {
      replacements[c] = map.get(c).toCharArray();
    }
    return replacements;
  }

  // Immutable empty array for when there are no replacements.

            

Reported by PMD.

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

Line: 57

                // instances.
  private final char[][] replacementArray;

  private ArrayBasedEscaperMap(char[][] replacementArray) {
    this.replacementArray = replacementArray;
  }

  // Returns the non-null array of replacements for fast lookup.
  char[][] getReplacementArray() {

            

Reported by PMD.

Found 'DD'-anomaly for variable 'replacements' (lines '76'-'78').
Error

Line: 76

                    return EMPTY_REPLACEMENT_ARRAY;
    }
    char max = Collections.max(map.keySet());
    char[][] replacements = new char[max + 1][];
    for (Character c : map.keySet()) {
      replacements[c] = map.get(c).toCharArray();
    }
    return replacements;
  }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'replacements' (lines '78'-'78').
Error

Line: 78

                  char max = Collections.max(map.keySet());
    char[][] replacements = new char[max + 1][];
    for (Character c : map.keySet()) {
      replacements[c] = map.get(c).toCharArray();
    }
    return replacements;
  }

  // Immutable empty array for when there are no replacements.

            

Reported by PMD.

android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java
6 issues
Avoid reassigning parameters such as 'safeMax'
Design

Line: 87

                 * @param safeMin the lowest character value in the safe range
   * @param safeMax the highest character value in the safe range
   */
  protected ArrayBasedCharEscaper(ArrayBasedEscaperMap escaperMap, char safeMin, char safeMax) {

    checkNotNull(escaperMap); // GWT specific check (do not optimize)
    this.replacements = escaperMap.getReplacementArray();
    this.replacementsLength = replacements.length;
    if (safeMax < safeMin) {

            

Reported by PMD.

Avoid reassigning parameters such as 'safeMin'
Design

Line: 87

                 * @param safeMin the lowest character value in the safe range
   * @param safeMax the highest character value in the safe range
   */
  protected ArrayBasedCharEscaper(ArrayBasedEscaperMap escaperMap, char safeMin, char safeMax) {

    checkNotNull(escaperMap); // GWT specific check (do not optimize)
    this.replacements = escaperMap.getReplacementArray();
    this.replacementsLength = replacements.length;
    if (safeMax < safeMin) {

            

Reported by PMD.

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

Line: 49

              @ElementTypesAreNonnullByDefault
public abstract class ArrayBasedCharEscaper extends CharEscaper {
  // The replacement array (see ArrayBasedEscaperMap).
  private final char[][] replacements;
  // The number of elements in the replacement array.
  private final int replacementsLength;
  // The first character in the safe range.
  private final char safeMin;
  // The last character in the safe range.

            

Reported by PMD.

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

Line: 51

                // The replacement array (see ArrayBasedEscaperMap).
  private final char[][] replacements;
  // The number of elements in the replacement array.
  private final int replacementsLength;
  // The first character in the safe range.
  private final char safeMin;
  // The last character in the safe range.
  private final char safeMax;


            

Reported by PMD.

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

Line: 53

                // The number of elements in the replacement array.
  private final int replacementsLength;
  // The first character in the safe range.
  private final char safeMin;
  // The last character in the safe range.
  private final char safeMax;

  /**
   * Creates a new ArrayBasedCharEscaper instance with the given replacement map and specified safe

            

Reported by PMD.

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

Line: 55

                // The first character in the safe range.
  private final char safeMin;
  // The last character in the safe range.
  private final char safeMax;

  /**
   * Creates a new ArrayBasedCharEscaper instance with the given replacement map and specified safe
   * range. If {@code safeMax < safeMin} then no characters are considered safe.
   *

            

Reported by PMD.

android/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java
6 issues
Avoid throwing raw exception types.
Design

Line: 73

                        wrapped.call();
        } catch (Exception e) {
          throwIfUnchecked(e);
          throw new RuntimeException(e);
        }
      }
    };
  }


            

Reported by PMD.

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

Line: 47

              @CanIgnoreReturnValue // TODO(cpovirk): Consider being more strict.
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class WrappingExecutorService implements ExecutorService {
  private final ExecutorService delegate;

  protected WrappingExecutorService(ExecutorService delegate) {
    this.delegate = checkNotNull(delegate);
  }

            

Reported by PMD.

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

Line: 48

              @GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class WrappingExecutorService implements ExecutorService {
  private final ExecutorService delegate;

  protected WrappingExecutorService(ExecutorService delegate) {
    this.delegate = checkNotNull(delegate);
  }


            

Reported by PMD.

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

Line: 71

                    public void run() {
        try {
          wrapped.call();
        } catch (Exception e) {
          throwIfUnchecked(e);
          throw new RuntimeException(e);
        }
      }
    };

            

Reported by PMD.

Found 'DU'-anomaly for variable 'wrapped' (lines '65'-'77').
Error

Line: 65

                 * delegates to {@link #wrapTask(Callable)}.
   */
  protected Runnable wrapTask(Runnable command) {
    final Callable<Object> wrapped = wrapTask(Executors.callable(command, null));
    return new Runnable() {
      @Override
      public void run() {
        try {
          wrapped.call();

            

Reported by PMD.

Found 'DU'-anomaly for variable 'wrapped' (lines '65'-'77').
Error

Line: 65

                 * delegates to {@link #wrapTask(Callable)}.
   */
  protected Runnable wrapTask(Runnable command) {
    final Callable<Object> wrapped = wrapTask(Executors.callable(command, null));
    return new Runnable() {
      @Override
      public void run() {
        try {
          wrapped.call();

            

Reported by PMD.