The following issues were found

guava/src/com/google/common/primitives/IntsMethodsForWeb.java
2 issues
No abstract method which means that the keyword is most likely used to prevent instantiation. Use a private or protected constructor instead.
Design

Line: 25

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class IntsMethodsForWeb {}

            

Reported by PMD.

This abstract class does not have any abstract methods
Design

Line: 25

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class IntsMethodsForWeb {}

            

Reported by PMD.

guava/src/com/google/common/reflect/Reflection.java
2 issues
In J2EE, getClassLoader() might not work as expected. Use Thread.currentThread().getContextClassLoader() instead.
Error

Line: 66

                public static void initialize(Class<?>... classes) {
    for (Class<?> clazz : classes) {
      try {
        Class.forName(clazz.getName(), true, clazz.getClassLoader());
      } catch (ClassNotFoundException e) {
        throw new AssertionError(e);
      }
    }
  }

            

Reported by PMD.

In J2EE, getClassLoader() might not work as expected. Use Thread.currentThread().getContextClassLoader() instead.
Error

Line: 87

                  checkArgument(interfaceType.isInterface(), "%s is not an interface", interfaceType);
    Object object =
        Proxy.newProxyInstance(
            interfaceType.getClassLoader(), new Class<?>[] {interfaceType}, handler);
    return interfaceType.cast(object);
  }

  private Reflection() {}
}

            

Reported by PMD.

guava/src/com/google/common/reflect/TypeCapture.java
2 issues
This abstract class does not have any abstract methods
Design

Line: 28

               * @author Ben Yu
 */
@ElementTypesAreNonnullByDefault
abstract class TypeCapture<T> {

  /** Returns the captured type. */
  final Type capture() {
    Type superclass = getClass().getGenericSuperclass();
    checkArgument(superclass instanceof ParameterizedType, "%s isn't parameterized", superclass);

            

Reported by PMD.

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

Line: 32

              
  /** Returns the captured type. */
  final Type capture() {
    Type superclass = getClass().getGenericSuperclass();
    checkArgument(superclass instanceof ParameterizedType, "%s isn't parameterized", superclass);
    return ((ParameterizedType) superclass).getActualTypeArguments()[0];
  }
}

            

Reported by PMD.

guava/src/com/google/common/hash/AbstractByteHasher.java
2 issues
This class has too many methods, consider refactoring it.
Design

Line: 36

               */
@CanIgnoreReturnValue
@ElementTypesAreNonnullByDefault
abstract class AbstractByteHasher extends AbstractHasher {
  private final ByteBuffer scratch = ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN);

  /** Updates this hasher with the given byte. */
  protected abstract void update(byte b);


            

Reported by PMD.

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

Line: 37

              @CanIgnoreReturnValue
@ElementTypesAreNonnullByDefault
abstract class AbstractByteHasher extends AbstractHasher {
  private final ByteBuffer scratch = ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN);

  /** Updates this hasher with the given byte. */
  protected abstract void update(byte b);

  /** Updates this hasher with the given bytes. */

            

Reported by PMD.

guava/src/com/google/common/collect/CompoundOrdering.java
2 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 31

              @ElementTypesAreNonnullByDefault
final class CompoundOrdering<T extends @Nullable Object> extends Ordering<T>
    implements Serializable {
  final Comparator<? super T>[] comparators;

  CompoundOrdering(Comparator<? super T> primary, Comparator<? super T> secondary) {
    this.comparators = (Comparator<? super T>[]) new Comparator[] {primary, secondary};
  }


            

Reported by PMD.

This for loop can be replaced by a foreach loop
Design

Line: 43

              
  @Override
  public int compare(@ParametricNullness T left, @ParametricNullness T right) {
    for (int i = 0; i < comparators.length; i++) {
      int result = comparators[i].compare(left, right);
      if (result != 0) {
        return result;
      }
    }

            

Reported by PMD.

guava/src/com/google/common/primitives/Platform.java
2 issues
Logger calls should be surrounded by log level guards.
Design

Line: 39

                            "https://stackoverflow.com/q/5189914/28465",
              "https://groups.google.com/d/msg/guava-announce/zHZTFg7YF3o/rQNnwdHeEwAJ"));
    }
    logger.log(
        java.util.logging.Level.WARNING,
        "Later in 2020, we will remove GWT-RPC support for Guava types. You are seeing this"
            + " warning because you are sending a Guava type over GWT-RPC, which will break. You"
            + " can identify which type by looking at the class name in the attached stack trace.",
        new Throwable());

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 31

              
    if (!Boolean.parseBoolean(System.getProperty(propertyName, "false"))) {
      throw new UnsupportedOperationException(
          com.google.common.base.Strings.lenientFormat(
              "We are removing GWT-RPC support for Guava types. You can temporarily reenable"
                  + " support by setting the system property %s to true. For more about system"
                  + " properties, see %s. For more about Guava's GWT-RPC support, see %s.",
              propertyName,
              "https://stackoverflow.com/q/5189914/28465",

            

Reported by PMD.

guava/src/com/google/common/xml/XmlEscapers.java
2 issues
A class which only has private constructors should be final
Design

Line: 44

              @Beta
@GwtCompatible
@ElementTypesAreNonnullByDefault
public class XmlEscapers {
  private XmlEscapers() {}

  private static final char MIN_ASCII_CONTROL_CHAR = 0x00;
  private static final char MAX_ASCII_CONTROL_CHAR = 0x1F;


            

Reported by PMD.

Avoid unused private fields such as 'XML_ESCAPER'.
Design

Line: 103

                  return XML_ATTRIBUTE_ESCAPER;
  }

  private static final Escaper XML_ESCAPER;
  private static final Escaper XML_CONTENT_ESCAPER;
  private static final Escaper XML_ATTRIBUTE_ESCAPER;

  static {
    Escapers.Builder builder = Escapers.builder();

            

Reported by PMD.

guava-tests/test/com/google/common/util/concurrent/ServiceTest.java
2 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: 33

              public class ServiceTest extends TestCase {

  /** Assert on the comparison ordering of the State enum since we guarantee it. */
  public void testStateOrdering() {
    // List every valid (direct) state transition.
    assertLessThan(NEW, STARTING);
    assertLessThan(NEW, TERMINATED);

    assertLessThan(STARTING, RUNNING);

            

Reported by PMD.

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

Line: 33

              public class ServiceTest extends TestCase {

  /** Assert on the comparison ordering of the State enum since we guarantee it. */
  public void testStateOrdering() {
    // List every valid (direct) state transition.
    assertLessThan(NEW, STARTING);
    assertLessThan(NEW, TERMINATED);

    assertLessThan(STARTING, RUNNING);

            

Reported by PMD.

guava/src/com/google/common/collect/ForwardingImmutableCollection.java
2 issues
A class which only has private constructors should be final
Design

Line: 28

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
class ForwardingImmutableCollection {
  private ForwardingImmutableCollection() {}
}

            

Reported by PMD.

Class cannot be instantiated and does not provide any static methods or fields
Error

Line: 28

               */
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
class ForwardingImmutableCollection {
  private ForwardingImmutableCollection() {}
}

            

Reported by PMD.

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

Line: 49

              @GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public interface SortedMultiset<E extends @Nullable Object>
    extends SortedMultisetBridge<E>, SortedIterable<E> {
  /**
   * Returns the comparator that orders this multiset, or {@link Ordering#natural()} if the natural
   * ordering of the elements is used.
   */
  @Override

            

Reported by PMD.

Avoid unused imports such as 'java.util.Collection'
Design

Line: 20

              package com.google.common.collect;

import com.google.common.annotations.GwtCompatible;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.NavigableSet;
import java.util.Set;
import javax.annotation.CheckForNull;

            

Reported by PMD.