The following issues were found

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

Line: 23

              @GwtCompatible
@ElementTypesAreNonnullByDefault
final class ParseRequest {
  final String rawValue;
  final int radix;

  private ParseRequest(String rawValue, int radix) {
    this.rawValue = rawValue;
    this.radix = radix;

            

Reported by PMD.

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

Line: 24

              @ElementTypesAreNonnullByDefault
final class ParseRequest {
  final String rawValue;
  final int radix;

  private ParseRequest(String rawValue, int radix) {
    this.rawValue = rawValue;
    this.radix = radix;
  }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 43

                  if (stringValue.startsWith("0x") || stringValue.startsWith("0X")) {
      rawValue = stringValue.substring(2);
      radix = 16;
    } else if (firstChar == '#') {
      rawValue = stringValue.substring(1);
      radix = 16;
    } else if (firstChar == '0' && stringValue.length() > 1) {
      rawValue = stringValue.substring(1);
      radix = 8;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'firstChar' (lines '39'-'55').
Error

Line: 39

                  // Handle radix specifier if present
    String rawValue;
    int radix;
    char firstChar = stringValue.charAt(0);
    if (stringValue.startsWith("0x") || stringValue.startsWith("0X")) {
      rawValue = stringValue.substring(2);
      radix = 16;
    } else if (firstChar == '#') {
      rawValue = stringValue.substring(1);

            

Reported by PMD.

android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java
4 issues
Class contains multiple getInstance methods. Please review.
Error

Line: 40

               * @since 13.0
 */
@Beta
public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B>
    implements TypeToInstanceMap<B> {

  private final Map<TypeToken<? extends B>, B> backingMap = Maps.newHashMap();

  @Override

            

Reported by PMD.

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

Line: 43

              public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B>
    implements TypeToInstanceMap<B> {

  private final Map<TypeToken<? extends B>, B> backingMap = Maps.newHashMap();

  @Override
  @NullableDecl
  public <T extends B> T getInstance(Class<T> type) {
    return trustedGet(TypeToken.of(type));

            

Reported by PMD.

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

Line: 122

              
  private static final class UnmodifiableEntry<K, V> extends ForwardingMapEntry<K, V> {

    private final Entry<K, V> delegate;

    static <K, V> Set<Entry<K, V>> transformEntries(final Set<Entry<K, V>> entries) {
      return new ForwardingSet<Map.Entry<K, V>>() {
        @Override
        protected Set<Entry<K, V>> delegate() {

            

Reported by PMD.

Field delegate has the same name as a method
Error

Line: 122

              
  private static final class UnmodifiableEntry<K, V> extends ForwardingMapEntry<K, V> {

    private final Entry<K, V> delegate;

    static <K, V> Set<Entry<K, V>> transformEntries(final Set<Entry<K, V>> entries) {
      return new ForwardingSet<Map.Entry<K, V>>() {
        @Override
        protected Set<Entry<K, V>> delegate() {

            

Reported by PMD.

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

Line: 258

                  for (int i = 0; i < length; i++) {
      builder.add(doubleToRawLongBits(s.readDouble()));
    }
    this.longs = new AtomicLongArray(builder.build().toArray());
  }
}

            

Reported by PMD.

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

Line: 71

                 * @param array the array to copy elements from
   * @throws NullPointerException if array is null
   */
  public AtomicDoubleArray(double[] array) {
    final int len = array.length;
    long[] longArray = new long[len];
    for (int i = 0; i < len; i++) {
      longArray[i] = doubleToRawLongBits(array[i]);
    }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'i' (lines '220'-'220').
Error

Line: 220

                  // Double.toString(Math.PI).length() == 17
    StringBuilder b = new StringBuilder((17 + 2) * (iMax + 1));
    b.append('[');
    for (int i = 0; ; i++) {
      b.append(longBitsToDouble(longs.get(i)));
      if (i == iMax) {
        return b.append(']').toString();
      }
      b.append(',').append(' ');

            

Reported by PMD.

Found 'DU'-anomaly for variable 'i' (lines '220'-'227').
Error

Line: 220

                  // Double.toString(Math.PI).length() == 17
    StringBuilder b = new StringBuilder((17 + 2) * (iMax + 1));
    b.append('[');
    for (int i = 0; ; i++) {
      b.append(longBitsToDouble(longs.get(i)));
      if (i == iMax) {
        return b.append(']').toString();
      }
      b.append(',').append(' ');

            

Reported by PMD.

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

Line: 89

                    @ParametricNullness
      public T call() throws Exception {
        Thread currentThread = Thread.currentThread();
        String oldName = currentThread.getName();
        boolean restoreName = trySetName(nameSupplier.get(), currentThread);
        try {
          return callable.call();
        } finally {
          if (restoreName) {

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 95

                        return callable.call();
        } finally {
          if (restoreName) {
            boolean unused = trySetName(oldName, currentThread);
          }
        }
      }
    };
  }

            

Reported by PMD.

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

Line: 118

                    @Override
      public void run() {
        Thread currentThread = Thread.currentThread();
        String oldName = currentThread.getName();
        boolean restoreName = trySetName(nameSupplier.get(), currentThread);
        try {
          task.run();
        } finally {
          if (restoreName) {

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 124

                        task.run();
        } finally {
          if (restoreName) {
            boolean unused = trySetName(oldName, currentThread);
          }
        }
      }
    };
  }

            

Reported by PMD.

android/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java
4 issues
System.err.println is used
Design

Line: 74

                    } catch (Throwable errorInLogging) {
        // If logging fails, e.g. due to missing memory, at least try to log the
        // message and the cause for the failed logging.
        System.err.println(e.getMessage());
        System.err.println(errorInLogging.getMessage());
      } finally {
        runtime.exit(1);
      }
    }

            

Reported by PMD.

System.err.println is used
Design

Line: 75

                      // If logging fails, e.g. due to missing memory, at least try to log the
        // message and the cause for the failed logging.
        System.err.println(e.getMessage());
        System.err.println(errorInLogging.getMessage());
      } finally {
        runtime.exit(1);
      }
    }
  }

            

Reported by PMD.

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

Line: 60

                static final class Exiter implements UncaughtExceptionHandler {
    private static final Logger logger = Logger.getLogger(Exiter.class.getName());

    private final Runtime runtime;

    Exiter(Runtime runtime) {
      this.runtime = runtime;
    }


            

Reported by PMD.

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

Line: 71

                    try {
        logger.log(
            SEVERE, String.format(Locale.ROOT, "Caught an exception in %s.  Shutting down.", t), e);
      } catch (Throwable errorInLogging) {
        // If logging fails, e.g. due to missing memory, at least try to log the
        // message and the cause for the failed logging.
        System.err.println(e.getMessage());
        System.err.println(errorInLogging.getMessage());
      } finally {

            

Reported by PMD.

guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/LongAdder.java
4 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 26

               */
class LongAdder implements LongAddable {

  private long value;

  public void increment() {
    value++;
  }


            

Reported by PMD.

The method 'increment()' is missing an @Override annotation.
Design

Line: 28

              
  private long value;

  public void increment() {
    value++;
  }

  public void add(long x) {
    value += x;

            

Reported by PMD.

The method 'add(long)' is missing an @Override annotation.
Design

Line: 32

                  value++;
  }

  public void add(long x) {
    value += x;
  }

  public long sum() {
    return value;

            

Reported by PMD.

The method 'sum()' is missing an @Override annotation.
Design

Line: 36

                  value += x;
  }

  public long sum() {
    return value;
  }
}

            

Reported by PMD.

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSortedSet.java
4 issues
Classes implementing Serializable should set a serialVersionUID
Error

Line: 27

               *
 * @author Hayward Chan
 */
final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {

  /** true if this set is a subset of another immutable sorted set. */
  final boolean isSubset;

  private Comparator<E> unusedComparatorForSerialization;

            

Reported by PMD.

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

Line: 30

              final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {

  /** true if this set is a subset of another immutable sorted set. */
  final boolean isSubset;

  private Comparator<E> unusedComparatorForSerialization;
  private E unusedElementForSerialization;

  RegularImmutableSortedSet(SortedSet<E> delegate, boolean isSubset) {

            

Reported by PMD.

Avoid unused private fields such as 'unusedComparatorForSerialization'.
Design

Line: 32

                /** true if this set is a subset of another immutable sorted set. */
  final boolean isSubset;

  private Comparator<E> unusedComparatorForSerialization;
  private E unusedElementForSerialization;

  RegularImmutableSortedSet(SortedSet<E> delegate, boolean isSubset) {
    super(delegate);
    this.isSubset = isSubset;

            

Reported by PMD.

Avoid unused private fields such as 'unusedElementForSerialization'.
Design

Line: 33

                final boolean isSubset;

  private Comparator<E> unusedComparatorForSerialization;
  private E unusedElementForSerialization;

  RegularImmutableSortedSet(SortedSet<E> delegate, boolean isSubset) {
    super(delegate);
    this.isSubset = isSubset;
  }

            

Reported by PMD.

guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableBiMap.java
4 issues
Classes implementing Serializable should set a serialVersionUID
Error

Line: 28

               *
 * @author Hayward Chan
 */
final class SingletonImmutableBiMap<K, V> extends ImmutableBiMap<K, V> {

  // These references are used both by the custom field serializer, and by the
  // GWT compiler to infer the keys and values of the map that needs to be
  // serialized.
  //

            

Reported by PMD.

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

Line: 36

                //
  // Although they are non-final, they are package private and the reference is
  // never modified after a map is constructed.
  K singleKey;
  V singleValue;

  transient SingletonImmutableBiMap<V, K> inverse;

  SingletonImmutableBiMap(K key, V value) {

            

Reported by PMD.

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

Line: 37

                // Although they are non-final, they are package private and the reference is
  // never modified after a map is constructed.
  K singleKey;
  V singleValue;

  transient SingletonImmutableBiMap<V, K> inverse;

  SingletonImmutableBiMap(K key, V value) {
    super(Collections.singletonMap(checkNotNull(key), checkNotNull(value)));

            

Reported by PMD.

Field inverse has the same name as a method
Error

Line: 39

                K singleKey;
  V singleValue;

  transient SingletonImmutableBiMap<V, K> inverse;

  SingletonImmutableBiMap(K key, V value) {
    super(Collections.singletonMap(checkNotNull(key), checkNotNull(value)));
    this.singleKey = key;
    this.singleValue = value;

            

Reported by PMD.

guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AggregateFutureState.java
4 issues
Avoid using redundant field initializer for 'seenExceptions'
Performance

Line: 27

              abstract class AggregateFutureState<OutputT> extends AbstractFuture.TrustedFuture<OutputT> {
  // Lazily initialized the first time we see an exception; not released until all the input futures
  // & this future completes. Released when the future releases the reference to the running state
  private Set<Throwable> seenExceptions = null;
  private int remaining;

  AggregateFutureState(int remainingFutures) {
    this.remaining = remainingFutures;
  }

            

Reported by PMD.

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

Line: 27

              abstract class AggregateFutureState<OutputT> extends AbstractFuture.TrustedFuture<OutputT> {
  // Lazily initialized the first time we see an exception; not released until all the input futures
  // & this future completes. Released when the future releases the reference to the running state
  private Set<Throwable> seenExceptions = null;
  private int remaining;

  AggregateFutureState(int remainingFutures) {
    this.remaining = remainingFutures;
  }

            

Reported by PMD.

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

Line: 28

                // Lazily initialized the first time we see an exception; not released until all the input futures
  // & this future completes. Released when the future releases the reference to the running state
  private Set<Throwable> seenExceptions = null;
  private int remaining;

  AggregateFutureState(int remainingFutures) {
    this.remaining = remainingFutures;
  }


            

Reported by PMD.

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

Line: 49

                }

  final void clearSeenExceptions() {
    seenExceptions = null;
  }
}

            

Reported by PMD.

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

Line: 54

                /** Returns an iterable whose iterator returns the given elements in order. */
  public static <E> MinimalIterable<E> of(E... elements) {
    // Make sure to get an unmodifiable iterator
    return new MinimalIterable<E>(Arrays.asList(elements).iterator());
  }

  /**
   * Returns an iterable whose iterator returns the given elements in order. The elements are copied
   * out of the source collection at the time this method is called.

            

Reported by PMD.

Field iterator has the same name as a method
Error

Line: 66

                  return (MinimalIterable) of(elements.toArray());
  }

  private Iterator<E> iterator;

  private MinimalIterable(Iterator<E> iterator) {
    this.iterator = iterator;
  }


            

Reported by PMD.

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

Line: 66

                  return (MinimalIterable) of(elements.toArray());
  }

  private Iterator<E> iterator;

  private MinimalIterable(Iterator<E> iterator) {
    this.iterator = iterator;
  }


            

Reported by PMD.

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

Line: 82

                  try {
      return iterator;
    } finally {
      iterator = null;
    }
  }
}

            

Reported by PMD.