The following issues were found

android/guava-tests/test/com/google/common/primitives/FloatArrayAsListTest.java
14 issues
This class name ends with Test but contains no test cases
Error

Line: 41

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class FloatArrayAsListTest extends TestCase {

  private static List<Float> asList(Float[] values) {
    float[] temp = new float[values.length];
    for (int i = 0; i < values.length; i++) {
      temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).

            

Reported by PMD.

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

Line: 51

                  return Floats.asList(temp);
  }

  @GwtIncompatible // suite
  public static Test suite() {
    List<ListTestSuiteBuilder<Float>> builders =
        ImmutableList.of(
            ListTestSuiteBuilder.using(new FloatsAsListGenerator()).named("Floats.asList"),
            ListTestSuiteBuilder.using(new FloatsAsListHeadSubListGenerator())

            

Reported by PMD.

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

Line: 66

                  TestSuite suite = new TestSuite();
    for (ListTestSuiteBuilder<Float> builder : builders) {
      suite.addTest(
          builder
              .withFeatures(
                  CollectionSize.ONE,
                  CollectionSize.SEVERAL,
                  CollectionFeature.RESTRICTS_ELEMENTS,
                  ListFeature.SUPPORTS_SET)

            

Reported by PMD.

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

Line: 92

                  protected List<Float> create(Float[] elements) {
      Float[] suffix = {Float.MIN_VALUE, Float.MAX_VALUE};
      Float[] all = concat(elements, suffix);
      return asList(all).subList(0, elements.length);
    }
  }

  public static final class FloatsAsListTailSubListGenerator extends TestFloatListGenerator {
    @Override

            

Reported by PMD.

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

Line: 101

                  protected List<Float> create(Float[] elements) {
      Float[] prefix = {(float) 86, (float) 99};
      Float[] all = concat(prefix, elements);
      return asList(all).subList(2, elements.length + 2);
    }
  }

  public static final class FloatsAsListMiddleSubListGenerator extends TestFloatListGenerator {
    @Override

            

Reported by PMD.

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

Line: 111

                    Float[] prefix = {Float.MIN_VALUE, Float.MAX_VALUE};
      Float[] suffix = {(float) 86, (float) 99};
      Float[] all = concat(concat(prefix, elements), suffix);
      return asList(all).subList(2, elements.length + 2);
    }
  }

  private static Float[] concat(Float[] left, Float[] right) {
    Float[] result = new Float[left.length + right.length];

            

Reported by PMD.

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

Line: 43

              @GwtCompatible(emulated = true)
public class FloatArrayAsListTest extends TestCase {

  private static List<Float> asList(Float[] values) {
    float[] temp = new float[values.length];
    for (int i = 0; i < values.length; i++) {
      temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).
    }
    return Floats.asList(temp);

            

Reported by PMD.

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

Line: 115

                  }
  }

  private static Float[] concat(Float[] left, Float[] right) {
    Float[] result = new Float[left.length + right.length];
    System.arraycopy(left, 0, result, 0, left.length);
    System.arraycopy(right, 0, result, left.length, right.length);
    return result;
  }

            

Reported by PMD.

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

Line: 142

                   * Creates a new collection containing the given elements; implement this method instead of
     * {@link #create(Object...)}.
     */
    protected abstract List<Float> create(Float[] elements);

    @Override
    public Float[] createArray(int length) {
      return new Float[length];
    }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'temp' (lines '44'-'46').
Error

Line: 44

              public class FloatArrayAsListTest extends TestCase {

  private static List<Float> asList(Float[] values) {
    float[] temp = new float[values.length];
    for (int i = 0; i < values.length; i++) {
      temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).
    }
    return Floats.asList(temp);
  }

            

Reported by PMD.

android/guava-tests/test/com/google/common/primitives/IntArrayAsListTest.java
14 issues
This class name ends with Test but contains no test cases
Error

Line: 42

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class IntArrayAsListTest extends TestCase {

  private static List<Integer> asList(Integer[] values) {
    int[] temp = new int[values.length];
    for (int i = 0; i < values.length; i++) {
      temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).

            

Reported by PMD.

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

Line: 52

                  return Ints.asList(temp);
  }

  @GwtIncompatible // suite
  public static Test suite() {
    List<ListTestSuiteBuilder<Integer>> builders =
        ImmutableList.of(
            ListTestSuiteBuilder.using(new IntsAsListGenerator()).named("Ints.asList"),
            ListTestSuiteBuilder.using(new IntsAsListHeadSubListGenerator())

            

Reported by PMD.

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

Line: 67

                  TestSuite suite = new TestSuite();
    for (ListTestSuiteBuilder<Integer> builder : builders) {
      suite.addTest(
          builder
              .withFeatures(
                  CollectionSize.ONE,
                  CollectionSize.SEVERAL,
                  CollectionFeature.RESTRICTS_ELEMENTS,
                  ListFeature.SUPPORTS_SET)

            

Reported by PMD.

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

Line: 93

                  protected List<Integer> create(Integer[] elements) {
      Integer[] suffix = {Integer.MIN_VALUE, Integer.MAX_VALUE};
      Integer[] all = concat(elements, suffix);
      return asList(all).subList(0, elements.length);
    }
  }

  public static final class IntsAsListTailSubListGenerator extends TestIntegerListGenerator {
    @Override

            

Reported by PMD.

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

Line: 102

                  protected List<Integer> create(Integer[] elements) {
      Integer[] prefix = {(int) 86, (int) 99};
      Integer[] all = concat(prefix, elements);
      return asList(all).subList(2, elements.length + 2);
    }
  }

  public static final class IntsAsListMiddleSubListGenerator extends TestIntegerListGenerator {
    @Override

            

Reported by PMD.

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

Line: 112

                    Integer[] prefix = {Integer.MIN_VALUE, Integer.MAX_VALUE};
      Integer[] suffix = {(int) 86, (int) 99};
      Integer[] all = concat(concat(prefix, elements), suffix);
      return asList(all).subList(2, elements.length + 2);
    }
  }

  private static Integer[] concat(Integer[] left, Integer[] right) {
    Integer[] result = new Integer[left.length + right.length];

            

Reported by PMD.

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

Line: 44

              @SuppressWarnings("cast") // redundant casts are intentional and harmless
public class IntArrayAsListTest extends TestCase {

  private static List<Integer> asList(Integer[] values) {
    int[] temp = new int[values.length];
    for (int i = 0; i < values.length; i++) {
      temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).
    }
    return Ints.asList(temp);

            

Reported by PMD.

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

Line: 116

                  }
  }

  private static Integer[] concat(Integer[] left, Integer[] right) {
    Integer[] result = new Integer[left.length + right.length];
    System.arraycopy(left, 0, result, 0, left.length);
    System.arraycopy(right, 0, result, left.length, right.length);
    return result;
  }

            

Reported by PMD.

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

Line: 143

                   * Creates a new collection containing the given elements; implement this method instead of
     * {@link #create(Object...)}.
     */
    protected abstract List<Integer> create(Integer[] elements);

    @Override
    public Integer[] createArray(int length) {
      return new Integer[length];
    }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'temp' (lines '45'-'47').
Error

Line: 45

              public class IntArrayAsListTest extends TestCase {

  private static List<Integer> asList(Integer[] values) {
    int[] temp = new int[values.length];
    for (int i = 0; i < values.length; i++) {
      temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).
    }
    return Ints.asList(temp);
  }

            

Reported by PMD.

android/guava-tests/test/com/google/common/primitives/LongArrayAsListTest.java
14 issues
This class name ends with Test but contains no test cases
Error

Line: 41

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class LongArrayAsListTest extends TestCase {

  private static List<Long> asList(Long[] values) {
    long[] temp = new long[values.length];
    for (int i = 0; i < values.length; i++) {
      temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).

            

Reported by PMD.

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

Line: 51

                  return Longs.asList(temp);
  }

  @GwtIncompatible // suite
  public static Test suite() {
    List<ListTestSuiteBuilder<Long>> builders =
        ImmutableList.of(
            ListTestSuiteBuilder.using(new LongsAsListGenerator()).named("Longs.asList"),
            ListTestSuiteBuilder.using(new LongsAsListHeadSubListGenerator())

            

Reported by PMD.

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

Line: 66

                  TestSuite suite = new TestSuite();
    for (ListTestSuiteBuilder<Long> builder : builders) {
      suite.addTest(
          builder
              .withFeatures(
                  CollectionSize.ONE,
                  CollectionSize.SEVERAL,
                  CollectionFeature.RESTRICTS_ELEMENTS,
                  ListFeature.SUPPORTS_SET)

            

Reported by PMD.

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

Line: 92

                  protected List<Long> create(Long[] elements) {
      Long[] suffix = {Long.MIN_VALUE, Long.MAX_VALUE};
      Long[] all = concat(elements, suffix);
      return asList(all).subList(0, elements.length);
    }
  }

  public static final class LongsAsListTailSubListGenerator extends TestLongListGenerator {
    @Override

            

Reported by PMD.

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

Line: 101

                  protected List<Long> create(Long[] elements) {
      Long[] prefix = {(long) 86, (long) 99};
      Long[] all = concat(prefix, elements);
      return asList(all).subList(2, elements.length + 2);
    }
  }

  public static final class LongsAsListMiddleSubListGenerator extends TestLongListGenerator {
    @Override

            

Reported by PMD.

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

Line: 111

                    Long[] prefix = {Long.MIN_VALUE, Long.MAX_VALUE};
      Long[] suffix = {(long) 86, (long) 99};
      Long[] all = concat(concat(prefix, elements), suffix);
      return asList(all).subList(2, elements.length + 2);
    }
  }

  private static Long[] concat(Long[] left, Long[] right) {
    Long[] result = new Long[left.length + right.length];

            

Reported by PMD.

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

Line: 43

              @GwtCompatible(emulated = true)
public class LongArrayAsListTest extends TestCase {

  private static List<Long> asList(Long[] values) {
    long[] temp = new long[values.length];
    for (int i = 0; i < values.length; i++) {
      temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).
    }
    return Longs.asList(temp);

            

Reported by PMD.

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

Line: 115

                  }
  }

  private static Long[] concat(Long[] left, Long[] right) {
    Long[] result = new Long[left.length + right.length];
    System.arraycopy(left, 0, result, 0, left.length);
    System.arraycopy(right, 0, result, left.length, right.length);
    return result;
  }

            

Reported by PMD.

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

Line: 142

                   * Creates a new collection containing the given elements; implement this method instead of
     * {@link #create(Object...)}.
     */
    protected abstract List<Long> create(Long[] elements);

    @Override
    public Long[] createArray(int length) {
      return new Long[length];
    }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'temp' (lines '44'-'46').
Error

Line: 44

              public class LongArrayAsListTest extends TestCase {

  private static List<Long> asList(Long[] values) {
    long[] temp = new long[values.length];
    for (int i = 0; i < values.length; i++) {
      temp[i] = checkNotNull(values[i]); // checkNotNull for GWT (do not optimize).
    }
    return Longs.asList(temp);
  }

            

Reported by PMD.

android/guava/src/com/google/common/util/concurrent/ForwardingExecutorService.java
14 issues
This class has too many methods, consider refactoring it.
Design

Line: 42

              @GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class ForwardingExecutorService extends ForwardingObject
    implements ExecutorService {
  /** Constructor for use by subclasses. */
  protected ForwardingExecutorService() {}

  @Override
  protected abstract ExecutorService delegate();

            

Reported by PMD.

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

Line: 51

              
  @Override
  public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
    return delegate().awaitTermination(timeout, unit);
  }

  @Override
  public <T extends @Nullable Object> List<Future<T>> invokeAll(
      Collection<? extends Callable<T>> tasks) throws InterruptedException {

            

Reported by PMD.

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

Line: 57

                @Override
  public <T extends @Nullable Object> List<Future<T>> invokeAll(
      Collection<? extends Callable<T>> tasks) throws InterruptedException {
    return delegate().invokeAll(tasks);
  }

  @Override
  public <T extends @Nullable Object> List<Future<T>> invokeAll(
      Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)

            

Reported by PMD.

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

Line: 64

                public <T extends @Nullable Object> List<Future<T>> invokeAll(
      Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
      throws InterruptedException {
    return delegate().invokeAll(tasks, timeout, unit);
  }

  @Override
  public <T extends @Nullable Object> T invokeAny(Collection<? extends Callable<T>> tasks)
      throws InterruptedException, ExecutionException {

            

Reported by PMD.

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

Line: 70

                @Override
  public <T extends @Nullable Object> T invokeAny(Collection<? extends Callable<T>> tasks)
      throws InterruptedException, ExecutionException {
    return delegate().invokeAny(tasks);
  }

  @Override
  public <T extends @Nullable Object> T invokeAny(
      Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)

            

Reported by PMD.

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

Line: 77

                public <T extends @Nullable Object> T invokeAny(
      Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
      throws InterruptedException, ExecutionException, TimeoutException {
    return delegate().invokeAny(tasks, timeout, unit);
  }

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

            

Reported by PMD.

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

Line: 82

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

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

            

Reported by PMD.

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

Line: 87

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

  @Override
  public void shutdown() {
    delegate().shutdown();

            

Reported by PMD.

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

Line: 92

              
  @Override
  public void shutdown() {
    delegate().shutdown();
  }

  @Override
  public List<Runnable> shutdownNow() {
    return delegate().shutdownNow();

            

Reported by PMD.

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

Line: 97

              
  @Override
  public List<Runnable> shutdownNow() {
    return delegate().shutdownNow();
  }

  @Override
  public void execute(Runnable command) {
    delegate().execute(command);

            

Reported by PMD.

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

Line: 68

                 * <p>{@code volatile} is required for j2objc transpiling:
   * https://developers.google.com/j2objc/guides/j2objc-memory-model#atomicity
   */
  @CheckForNull private volatile InterruptibleTask<?> task;

  TrustedListenableFutureTask(Callable<V> callable) {
    this.task = new TrustedFutureInterruptibleTask(callable);
  }


            

Reported by PMD.

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

Line: 88

                   * In the Async case, we may have called setFuture(pendingFuture), in which case afterDone()
     * won't have been called yet.
     */
    this.task = null;
  }

  @Override
  protected void afterDone() {
    super.afterDone();

            

Reported by PMD.

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

Line: 98

                  if (wasInterrupted()) {
      InterruptibleTask<?> localTask = task;
      if (localTask != null) {
        localTask.interruptTask();
      }
    }

    this.task = null;
  }

            

Reported by PMD.

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

Line: 102

                    }
    }

    this.task = null;
  }

  @Override
  @CheckForNull
  protected String pendingToString() {

            

Reported by PMD.

Classes implementing Serializable should set a serialVersionUID
Error

Line: 116

                }

  @WeakOuter
  private final class TrustedFutureInterruptibleTask extends InterruptibleTask<V> {
    private final Callable<V> callable;

    TrustedFutureInterruptibleTask(Callable<V> callable) {
      this.callable = checkNotNull(callable);
    }

            

Reported by PMD.

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

Line: 117

              
  @WeakOuter
  private final class TrustedFutureInterruptibleTask extends InterruptibleTask<V> {
    private final Callable<V> callable;

    TrustedFutureInterruptibleTask(Callable<V> callable) {
      this.callable = checkNotNull(callable);
    }


            

Reported by PMD.

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

Line: 125

              
    @Override
    final boolean isDone() {
      return TrustedListenableFutureTask.this.isDone();
    }

    @Override
    @ParametricNullness
    V runInterruptibly() throws Exception {

            

Reported by PMD.

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

Line: 125

              
    @Override
    final boolean isDone() {
      return TrustedListenableFutureTask.this.isDone();
    }

    @Override
    @ParametricNullness
    V runInterruptibly() throws Exception {

            

Reported by PMD.

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

Line: 136

              
    @Override
    void afterRanInterruptiblySuccess(@ParametricNullness V result) {
      TrustedListenableFutureTask.this.set(result);
    }

    @Override
    void afterRanInterruptiblyFailure(Throwable error) {
      setException(error);

            

Reported by PMD.

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

Line: 136

              
    @Override
    void afterRanInterruptiblySuccess(@ParametricNullness V result) {
      TrustedListenableFutureTask.this.set(result);
    }

    @Override
    void afterRanInterruptiblyFailure(Throwable error) {
      setException(error);

            

Reported by PMD.

android/guava/src/com/google/common/hash/AbstractHashFunction.java
14 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 36

                @Override
  public <T extends @Nullable Object> HashCode hashObject(
      @ParametricNullness T instance, Funnel<? super T> funnel) {
    return newHasher().putObject(instance, funnel).hash();
  }

  @Override
  public HashCode hashUnencodedChars(CharSequence input) {
    int len = input.length();

            

Reported by PMD.

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

Line: 36

                @Override
  public <T extends @Nullable Object> HashCode hashObject(
      @ParametricNullness T instance, Funnel<? super T> funnel) {
    return newHasher().putObject(instance, funnel).hash();
  }

  @Override
  public HashCode hashUnencodedChars(CharSequence input) {
    int len = input.length();

            

Reported by PMD.

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

Line: 42

                @Override
  public HashCode hashUnencodedChars(CharSequence input) {
    int len = input.length();
    return newHasher(len * 2).putUnencodedChars(input).hash();
  }

  @Override
  public HashCode hashString(CharSequence input, Charset charset) {
    return newHasher().putString(input, charset).hash();

            

Reported by PMD.

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

Line: 42

                @Override
  public HashCode hashUnencodedChars(CharSequence input) {
    int len = input.length();
    return newHasher(len * 2).putUnencodedChars(input).hash();
  }

  @Override
  public HashCode hashString(CharSequence input, Charset charset) {
    return newHasher().putString(input, charset).hash();

            

Reported by PMD.

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

Line: 47

              
  @Override
  public HashCode hashString(CharSequence input, Charset charset) {
    return newHasher().putString(input, charset).hash();
  }

  @Override
  public HashCode hashInt(int input) {
    return newHasher(4).putInt(input).hash();

            

Reported by PMD.

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

Line: 47

              
  @Override
  public HashCode hashString(CharSequence input, Charset charset) {
    return newHasher().putString(input, charset).hash();
  }

  @Override
  public HashCode hashInt(int input) {
    return newHasher(4).putInt(input).hash();

            

Reported by PMD.

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

Line: 52

              
  @Override
  public HashCode hashInt(int input) {
    return newHasher(4).putInt(input).hash();
  }

  @Override
  public HashCode hashLong(long input) {
    return newHasher(8).putLong(input).hash();

            

Reported by PMD.

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

Line: 52

              
  @Override
  public HashCode hashInt(int input) {
    return newHasher(4).putInt(input).hash();
  }

  @Override
  public HashCode hashLong(long input) {
    return newHasher(8).putLong(input).hash();

            

Reported by PMD.

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

Line: 57

              
  @Override
  public HashCode hashLong(long input) {
    return newHasher(8).putLong(input).hash();
  }

  @Override
  public HashCode hashBytes(byte[] input) {
    return hashBytes(input, 0, input.length);

            

Reported by PMD.

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

Line: 57

              
  @Override
  public HashCode hashLong(long input) {
    return newHasher(8).putLong(input).hash();
  }

  @Override
  public HashCode hashBytes(byte[] input) {
    return hashBytes(input, 0, input.length);

            

Reported by PMD.

android/guava/src/com/google/common/hash/FarmHashFingerprint64.java
14 issues
Avoid reassigning parameters such as 'seedA'
Design

Line: 102

                 * new arrays every time.
   */
  private static void weakHashLength32WithSeeds(
      byte[] bytes, int offset, long seedA, long seedB, long[] output) {
    long part1 = load64(bytes, offset);
    long part2 = load64(bytes, offset + 8);
    long part3 = load64(bytes, offset + 16);
    long part4 = load64(bytes, offset + 24);


            

Reported by PMD.

Avoid reassigning parameters such as 'seedB'
Design

Line: 102

                 * new arrays every time.
   */
  private static void weakHashLength32WithSeeds(
      byte[] bytes, int offset, long seedA, long seedB, long[] output) {
    long part1 = load64(bytes, offset);
    long part2 = load64(bytes, offset + 8);
    long part3 = load64(bytes, offset + 16);
    long part4 = load64(bytes, offset + 24);


            

Reported by PMD.

Avoid reassigning parameters such as 'seedB'
Design

Line: 102

                 * new arrays every time.
   */
  private static void weakHashLength32WithSeeds(
      byte[] bytes, int offset, long seedA, long seedB, long[] output) {
    long part1 = load64(bytes, offset);
    long part2 = load64(bytes, offset + 8);
    long part3 = load64(bytes, offset + 16);
    long part4 = load64(bytes, offset + 24);


            

Reported by PMD.

Avoid reassigning parameters such as 'seedA'
Design

Line: 102

                 * new arrays every time.
   */
  private static void weakHashLength32WithSeeds(
      byte[] bytes, int offset, long seedA, long seedB, long[] output) {
    long part1 = load64(bytes, offset);
    long part2 = load64(bytes, offset + 8);
    long part3 = load64(bytes, offset + 16);
    long part4 = load64(bytes, offset + 24);


            

Reported by PMD.

Avoid reassigning parameters such as 'seedA'
Design

Line: 102

                 * new arrays every time.
   */
  private static void weakHashLength32WithSeeds(
      byte[] bytes, int offset, long seedA, long seedB, long[] output) {
    long part1 = load64(bytes, offset);
    long part2 = load64(bytes, offset + 8);
    long part3 = load64(bytes, offset + 16);
    long part4 = load64(bytes, offset + 24);


            

Reported by PMD.

Avoid reassigning parameters such as 'offset'
Design

Line: 172

                /*
   * Compute an 8-byte hash of a byte array of length greater than 64 bytes.
   */
  private static long hashLength65Plus(byte[] bytes, int offset, int length) {
    final int seed = 81;
    // For strings over 64 bytes we loop. Internal state consists of 56 bytes: v, w, x, y, and z.
    long x = seed;
    @SuppressWarnings("ConstantOverflow")
    long y = seed * K1 + 113;

            

Reported by PMD.

Avoid reassigning parameters such as 'offset'
Design

Line: 172

                /*
   * Compute an 8-byte hash of a byte array of length greater than 64 bytes.
   */
  private static long hashLength65Plus(byte[] bytes, int offset, int length) {
    final int seed = 81;
    // For strings over 64 bytes we loop. Internal state consists of 56 bytes: v, w, x, y, and z.
    long x = seed;
    @SuppressWarnings("ConstantOverflow")
    long y = seed * K1 + 113;

            

Reported by PMD.

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

Line: 42

               * @author Geoff Pike
 */
@ElementTypesAreNonnullByDefault
final class FarmHashFingerprint64 extends AbstractNonStreamingHashFunction {
  static final HashFunction FARMHASH_FINGERPRINT_64 = new FarmHashFingerprint64();

  // Some primes between 2^63 and 2^64 for various uses.
  private static final long K0 = 0xc3a5c85c97cb3127L;
  private static final long K1 = 0xb492b66fbe98f273L;

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 70

              
  @VisibleForTesting
  static long fingerprint(byte[] bytes, int offset, int length) {
    if (length <= 32) {
      if (length <= 16) {
        return hashLength0to16(bytes, offset, length);
      } else {
        return hashLength17to32(bytes, offset, length);
      }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 71

                @VisibleForTesting
  static long fingerprint(byte[] bytes, int offset, int length) {
    if (length <= 32) {
      if (length <= 16) {
        return hashLength0to16(bytes, offset, length);
      } else {
        return hashLength17to32(bytes, offset, length);
      }
    } else if (length <= 64) {

            

Reported by PMD.

guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveAllTester.java
14 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: 44

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapRemoveAllTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
  @MapFeature.Require(SUPPORTS_REMOVE)
  public void testRemoveAllAbsentKey() {
    assertEmpty(multimap().removeAll(k3()));
    expectUnchanged();
  }


            

Reported by PMD.

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

Line: 46

              public class MultimapRemoveAllTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
  @MapFeature.Require(SUPPORTS_REMOVE)
  public void testRemoveAllAbsentKey() {
    assertEmpty(multimap().removeAll(k3()));
    expectUnchanged();
  }

  @CollectionSize.Require(absent = ZERO)
  @MapFeature.Require(SUPPORTS_REMOVE)

            

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

                  expectUnchanged();
  }

  @CollectionSize.Require(absent = ZERO)
  @MapFeature.Require(SUPPORTS_REMOVE)
  public void testRemoveAllPresentKey() {
    assertContentsAnyOrder(multimap().removeAll(k0()), v0());
    expectMissing(e0());
  }

            

Reported by PMD.

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

Line: 53

                @CollectionSize.Require(absent = ZERO)
  @MapFeature.Require(SUPPORTS_REMOVE)
  public void testRemoveAllPresentKey() {
    assertContentsAnyOrder(multimap().removeAll(k0()), v0());
    expectMissing(e0());
  }

  @CollectionSize.Require(absent = ZERO)
  @MapFeature.Require(SUPPORTS_REMOVE)

            

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

                  expectMissing(e0());
  }

  @CollectionSize.Require(absent = ZERO)
  @MapFeature.Require(SUPPORTS_REMOVE)
  public void testRemoveAllPropagatesToGet() {
    Collection<V> getResult = multimap().get(k0());

    multimap().removeAll(k0());

            

Reported by PMD.

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

Line: 60

                @CollectionSize.Require(absent = ZERO)
  @MapFeature.Require(SUPPORTS_REMOVE)
  public void testRemoveAllPropagatesToGet() {
    Collection<V> getResult = multimap().get(k0());

    multimap().removeAll(k0());

    assertEmpty(getResult);
    expectMissing(e0());

            

Reported by PMD.

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

Line: 62

                public void testRemoveAllPropagatesToGet() {
    Collection<V> getResult = multimap().get(k0());

    multimap().removeAll(k0());

    assertEmpty(getResult);
    expectMissing(e0());
  }


            

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

                  expectMissing(e0());
  }

  @CollectionSize.Require(SEVERAL)
  @MapFeature.Require(SUPPORTS_REMOVE)
  public void testRemoveAllMultipleValues() {
    resetContainer(
        Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k0(), v2()));


            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 70

              
  @CollectionSize.Require(SEVERAL)
  @MapFeature.Require(SUPPORTS_REMOVE)
  public void testRemoveAllMultipleValues() {
    resetContainer(
        Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k0(), v2()));

    assertContentsAnyOrder(multimap().removeAll(k0()), v0(), v1(), v2());
    assertEmpty(multimap());

            

Reported by PMD.

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

Line: 74

                  resetContainer(
        Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k0(), v2()));

    assertContentsAnyOrder(multimap().removeAll(k0()), v0(), v1(), v2());
    assertEmpty(multimap());
  }

  @CollectionSize.Require(absent = ZERO)
  @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})

            

Reported by PMD.

android/guava/src/com/google/common/escape/Escapers.java
14 issues
Return an empty array rather than null.
Error

Line: 58

              
        @Override
        @CheckForNull
        protected char[] escape(char c) {
          // TODO: Fix tests not to call this directly and make it throw an error.
          return null;
        }
      };


            

Reported by PMD.

The class 'Escapers' has a Modified Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 37

              @Beta
@GwtCompatible
@ElementTypesAreNonnullByDefault
public final class Escapers {
  private Escapers() {}

  /**
   * Returns an {@link Escaper} that does no escaping, passing all character data through unchanged.
   */

            

Reported by PMD.

The class 'Escapers' has a Standard Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 37

              @Beta
@GwtCompatible
@ElementTypesAreNonnullByDefault
public final class Escapers {
  private Escapers() {}

  /**
   * Returns an {@link Escaper} that does no escaping, passing all character data through unchanged.
   */

            

Reported by PMD.

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

Line: 98

                 */
  @Beta
  public static final class Builder {
    private final Map<Character, String> replacementMap = new HashMap<>();
    private char safeMin = Character.MIN_VALUE;
    private char safeMax = Character.MAX_VALUE;
    @CheckForNull private String unsafeReplacement = null;

    // The constructor is exposed via the builder() method above.

            

Reported by PMD.

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

Line: 99

                @Beta
  public static final class Builder {
    private final Map<Character, String> replacementMap = new HashMap<>();
    private char safeMin = Character.MIN_VALUE;
    private char safeMax = Character.MAX_VALUE;
    @CheckForNull private String unsafeReplacement = null;

    // The constructor is exposed via the builder() method above.
    private Builder() {}

            

Reported by PMD.

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

Line: 100

                public static final class Builder {
    private final Map<Character, String> replacementMap = new HashMap<>();
    private char safeMin = Character.MIN_VALUE;
    private char safeMax = Character.MAX_VALUE;
    @CheckForNull private String unsafeReplacement = null;

    // The constructor is exposed via the builder() method above.
    private Builder() {}


            

Reported by PMD.

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

Line: 101

                  private final Map<Character, String> replacementMap = new HashMap<>();
    private char safeMin = Character.MIN_VALUE;
    private char safeMax = Character.MAX_VALUE;
    @CheckForNull private String unsafeReplacement = null;

    // The constructor is exposed via the builder() method above.
    private Builder() {}

    /**

            

Reported by PMD.

Avoid using redundant field initializer for 'unsafeReplacement'
Performance

Line: 101

                  private final Map<Character, String> replacementMap = new HashMap<>();
    private char safeMin = Character.MIN_VALUE;
    private char safeMax = Character.MAX_VALUE;
    @CheckForNull private String unsafeReplacement = null;

    // The constructor is exposed via the builder() method above.
    private Builder() {}

    /**

            

Reported by PMD.

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

Line: 194

                  // In practice this shouldn't happen because it would be very odd not to
    // extend either CharEscaper or UnicodeEscaper for non trivial cases.
    throw new IllegalArgumentException(
        "Cannot create a UnicodeEscaper from: " + escaper.getClass().getName());
  }

  /**
   * Returns a string that would replace the given character in the specified escaper, or {@code
   * null} if no replacement should be made. This method is intended for use in tests through the

            

Reported by PMD.

The method 'wrap' has a Standard Cyclomatic Complexity of 10.
Design

Line: 231

                }

  /** Private helper to wrap a CharEscaper as a UnicodeEscaper. */
  private static UnicodeEscaper wrap(final CharEscaper escaper) {
    return new UnicodeEscaper() {
      @Override
      @CheckForNull
      protected char[] escape(int cp) {
        // If a code point maps to a single character, just escape that.

            

Reported by PMD.

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

Line: 41

               */
public class ListenableFutureTester {

  private final ExecutorService exec;
  private final ListenableFuture<?> future;
  private final CountDownLatch latch;

  public ListenableFutureTester(ListenableFuture<?> future) {
    this.exec = Executors.newCachedThreadPool();

            

Reported by PMD.

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

Line: 42

              public class ListenableFutureTester {

  private final ExecutorService exec;
  private final ListenableFuture<?> future;
  private final CountDownLatch latch;

  public ListenableFutureTester(ListenableFuture<?> future) {
    this.exec = Executors.newCachedThreadPool();
    this.future = checkNotNull(future);

            

Reported by PMD.

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

Line: 43

              
  private final ExecutorService exec;
  private final ListenableFuture<?> future;
  private final CountDownLatch latch;

  public ListenableFutureTester(ListenableFuture<?> future) {
    this.exec = Executors.newCachedThreadPool();
    this.future = checkNotNull(future);
    this.latch = new CountDownLatch(1);

            

Reported by PMD.

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

Line: 51

                  this.latch = new CountDownLatch(1);
  }

  public void setUp() {
    future.addListener(
        new Runnable() {
          @Override
          public void run() {
            latch.countDown();

            

Reported by PMD.

JUnit 4 tests that clean up tests should use the @After annotation, JUnit5 tests should use @AfterEach or @AfterAll
Design

Line: 66

                  assertFalse(future.isCancelled());
  }

  public void tearDown() {
    exec.shutdown();
  }

  public void testCompletedFuture(@NullableDecl Object expectedValue)
      throws InterruptedException, ExecutionException {

            

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

                  exec.shutdown();
  }

  public void testCompletedFuture(@NullableDecl Object expectedValue)
      throws InterruptedException, ExecutionException {
    assertTrue(future.isDone());
    assertFalse(future.isCancelled());

    assertTrue(latch.await(5, TimeUnit.SECONDS));

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 70

                  exec.shutdown();
  }

  public void testCompletedFuture(@NullableDecl Object expectedValue)
      throws InterruptedException, ExecutionException {
    assertTrue(future.isDone());
    assertFalse(future.isCancelled());

    assertTrue(latch.await(5, TimeUnit.SECONDS));

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 82

                  assertEquals(expectedValue, future.get());
  }

  public void testCancelledFuture() throws InterruptedException, ExecutionException {
    assertTrue(future.isDone());
    assertTrue(future.isCancelled());

    assertTrue(latch.await(5, TimeUnit.SECONDS));
    assertTrue(future.isDone());

            

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

                  assertEquals(expectedValue, future.get());
  }

  public void testCancelledFuture() throws InterruptedException, ExecutionException {
    assertTrue(future.isDone());
    assertTrue(future.isCancelled());

    assertTrue(latch.await(5, TimeUnit.SECONDS));
    assertTrue(future.isDone());

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 97

                  }
  }

  public void testFailedFuture(@NullableDecl String message) throws InterruptedException {
    assertTrue(future.isDone());
    assertFalse(future.isCancelled());

    assertTrue(latch.await(5, TimeUnit.SECONDS));
    assertTrue(future.isDone());

            

Reported by PMD.