The following issues were found

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

Line: 61

               */
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class ComparisonChain {
  private ComparisonChain() {}

  /** Begins a new chained comparison statement. See example in the class documentation. */
  public static ComparisonChain start() {
    return ACTIVE;

            

Reported by PMD.

Field result has the same name as a method
Error

Line: 128

                private static final ComparisonChain GREATER = new InactiveComparisonChain(1);

  private static final class InactiveComparisonChain extends ComparisonChain {
    final int result;

    InactiveComparisonChain(int result) {
      this.result = result;
    }


            

Reported by PMD.

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

Line: 128

                private static final ComparisonChain GREATER = new InactiveComparisonChain(1);

  private static final class InactiveComparisonChain extends ComparisonChain {
    final int result;

    InactiveComparisonChain(int result) {
      this.result = result;
    }


            

Reported by PMD.

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

Line: 36

              @ElementTypesAreNonnullByDefault
public final class CountingInputStream extends FilterInputStream {

  private long count;
  private long mark = -1;

  /**
   * Wraps another input stream, counting the number of bytes read.
   *

            

Reported by PMD.

Field mark has the same name as a method
Error

Line: 37

              public final class CountingInputStream extends FilterInputStream {

  private long count;
  private long mark = -1;

  /**
   * Wraps another input stream, counting the number of bytes read.
   *
   * @param in the input stream to be wrapped

            

Reported by PMD.

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

Line: 37

              public final class CountingInputStream extends FilterInputStream {

  private long count;
  private long mark = -1;

  /**
   * Wraps another input stream, counting the number of bytes read.
   *
   * @param in the input stream to be wrapped

            

Reported by PMD.

guava/src/com/google/common/collect/CollectPreconditions.java
3 issues
Avoid throwing null pointer exceptions.
Design

Line: 31

              
  static void checkEntryNotNull(Object key, Object value) {
    if (key == null) {
      throw new NullPointerException("null key in entry: null=" + value);
    } else if (value == null) {
      throw new NullPointerException("null value in entry: " + key + "=null");
    }
  }


            

Reported by PMD.

Avoid throwing null pointer exceptions.
Design

Line: 33

                  if (key == null) {
      throw new NullPointerException("null key in entry: null=" + value);
    } else if (value == null) {
      throw new NullPointerException("null value in entry: " + key + "=null");
    }
  }

  @CanIgnoreReturnValue
  static int checkNonnegative(int value, String name) {

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 27

              /** Precondition checks useful in collection implementations. */
@GwtCompatible
@ElementTypesAreNonnullByDefault
final class CollectPreconditions {

  static void checkEntryNotNull(Object key, Object value) {
    if (key == null) {
      throw new NullPointerException("null key in entry: null=" + value);
    } else if (value == null) {

            

Reported by PMD.

guava/src/com/google/common/collect/AbstractSetMultimap.java
3 issues
Overriding method merely calls super
Design

Line: 125

                 * values.
   */
  @Override
  public Map<K, Collection<V>> asMap() {
    return super.asMap();
  }

  /**
   * Stores a key-value pair in the multimap.

            

Reported by PMD.

Overriding method merely calls super
Design

Line: 150

                 * Equality does not depend on the ordering of keys or values.
   */
  @Override
  public boolean equals(@CheckForNull Object object) {
    return super.equals(object);
  }

  private static final long serialVersionUID = 7431625294878419160L;
}

            

Reported by PMD.

Ensure you override both equals() and hashCode()
Error

Line: 150

                 * Equality does not depend on the ordering of keys or values.
   */
  @Override
  public boolean equals(@CheckForNull Object object) {
    return super.equals(object);
  }

  private static final long serialVersionUID = 7431625294878419160L;
}

            

Reported by PMD.

guava/src/com/google/common/math/MathPreconditions.java
3 issues
This class has too many methods, consider refactoring it.
Design

Line: 30

              @GwtCompatible
@CanIgnoreReturnValue
@ElementTypesAreNonnullByDefault
final class MathPreconditions {
  static int checkPositive(String role, int x) {
    if (x <= 0) {
      throw new IllegalArgumentException(role + " (" + x + ") must be > 0");
    }
    return x;

            

Reported by PMD.

The String literal ') must be >= 0' appears 4 times in this file; the first occurrence is on line 54
Error

Line: 54

              
  static int checkNonNegative(String role, int x) {
    if (x < 0) {
      throw new IllegalArgumentException(role + " (" + x + ") must be >= 0");
    }
    return x;
  }

  static long checkNonNegative(String role, long x) {

            

Reported by PMD.

Use opposite operator instead of the logic complement operator.
Design

Line: 74

                }

  static double checkNonNegative(String role, double x) {
    if (!(x >= 0)) { // not x < 0, to work with NaN.
      throw new IllegalArgumentException(role + " (" + x + ") must be >= 0");
    }
    return x;
  }


            

Reported by PMD.

guava/src/com/google/common/collect/AbstractListMultimap.java
3 issues
Overriding method merely calls super
Design

Line: 128

                 * values.
   */
  @Override
  public Map<K, Collection<V>> asMap() {
    return super.asMap();
  }

  /**
   * Compares the specified object to this multimap for equality.

            

Reported by PMD.

Overriding method merely calls super
Design

Line: 139

                 * in the same order. If the value orderings disagree, the multimaps will not be considered equal.
   */
  @Override
  public boolean equals(@CheckForNull Object object) {
    return super.equals(object);
  }

  private static final long serialVersionUID = 6588350623831699109L;
}

            

Reported by PMD.

Ensure you override both equals() and hashCode()
Error

Line: 139

                 * in the same order. If the value orderings disagree, the multimaps will not be considered equal.
   */
  @Override
  public boolean equals(@CheckForNull Object object) {
    return super.equals(object);
  }

  private static final long serialVersionUID = 6588350623831699109L;
}

            

Reported by PMD.

guava/src/com/google/common/cache/LongAddables.java
3 issues
All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 28

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
final class LongAddables {
  private static final Supplier<LongAddable> SUPPLIER;

  static {
    Supplier<LongAddable> supplier;
    try {

            

Reported by PMD.

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

Line: 42

                            return new LongAdder();
            }
          };
    } catch (Throwable t) { // we really want to catch *everything*
      supplier =
          new Supplier<LongAddable>() {
            @Override
            public LongAddable get() {
              return new PureJavaLongAddable();

            

Reported by PMD.

Classes implementing Serializable should set a serialVersionUID
Error

Line: 58

                  return SUPPLIER.get();
  }

  private static final class PureJavaLongAddable extends AtomicLong implements LongAddable {
    @Override
    public void increment() {
      getAndIncrement();
    }


            

Reported by PMD.

guava/src/com/google/common/primitives/UnsignedInts.java
3 issues
This class has too many methods, consider refactoring it.
Design

Line: 51

              @Beta
@GwtCompatible
@ElementTypesAreNonnullByDefault
public final class UnsignedInts {
  static final long INT_MASK = 0xffffffffL;

  private UnsignedInts() {}

  static int flip(int value) {

            

Reported by PMD.

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

Line: 220

                 *
   * @since 23.1
   */
  public static void sort(int[] array) {
    checkNotNull(array);
    sort(array, 0, array.length);
  }

  /**

            

Reported by PMD.

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

Line: 249

                 *
   * @since 23.1
   */
  public static void sortDescending(int[] array) {
    checkNotNull(array);
    sortDescending(array, 0, array.length);
  }

  /**

            

Reported by PMD.

guava/src/com/google/common/base/JdkPattern.java
3 issues
Field pattern has the same name as a method
Error

Line: 26

              @ElementTypesAreNonnullByDefault
@GwtIncompatible
final class JdkPattern extends CommonPattern implements Serializable {
  private final Pattern pattern;

  JdkPattern(Pattern pattern) {
    this.pattern = Preconditions.checkNotNull(pattern);
  }


            

Reported by PMD.

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

Line: 26

              @ElementTypesAreNonnullByDefault
@GwtIncompatible
final class JdkPattern extends CommonPattern implements Serializable {
  private final Pattern pattern;

  JdkPattern(Pattern pattern) {
    this.pattern = Preconditions.checkNotNull(pattern);
  }


            

Reported by PMD.

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

Line: 53

                }

  private static final class JdkMatcher extends CommonMatcher {
    final Matcher matcher;

    JdkMatcher(Matcher matcher) {
      this.matcher = Preconditions.checkNotNull(matcher);
    }


            

Reported by PMD.

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

Line: 39

                 * there: cancel() never reads this field, only writes to it. That makes the race here completely
   * harmless, rather than just 99.99% harmless.
   */
  @CheckForNull private List<@Nullable Present<V>> values;

  CollectionFuture(
      ImmutableCollection<? extends ListenableFuture<? extends V>> futures,
      boolean allMustSucceed) {
    super(futures, allMustSucceed, true);

            

Reported by PMD.

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

Line: 78

                @Override
  void releaseResources(ReleaseResourcesReason reason) {
    super.releaseResources(reason);
    this.values = null;
  }

  abstract C combine(List<@Nullable Present<V>> values);

  /** Used for {@link Futures#allAsList} and {@link Futures#successfulAsList}. */

            

Reported by PMD.

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

Line: 105

              
  /** The result of a successful {@code Future}. */
  private static final class Present<V extends @Nullable Object> {
    V value;

    Present(V value) {
      this.value = value;
    }
  }

            

Reported by PMD.