The following issues were found

guava-tests/test/com/google/common/graph/NetworkEquivalenceTest.java
33 issues
This class has too many methods, consider refactoring it.
Design

Line: 34

              @AndroidIncompatible
// TODO(cpovirk): Figure out Android JUnit 4 support. Does it work with Gingerbread? @RunWith?
@RunWith(Parameterized.class)
public final class NetworkEquivalenceTest {
  private static final Integer N1 = 1;
  private static final Integer N2 = 2;
  private static final Integer N3 = 3;

  private static final String E11 = "1-1";

            

Reported by PMD.

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

Line: 44

                private static final String E12_A = "1-2a";
  private static final String E13 = "1-3";

  private final EdgeType edgeType;
  private final MutableNetwork<Integer, String> network;

  // add parameters: directed/undirected
  @Parameters
  public static Collection<Object[]> parameters() {

            

Reported by PMD.

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

Line: 45

                private static final String E13 = "1-3";

  private final EdgeType edgeType;
  private final MutableNetwork<Integer, String> network;

  // add parameters: directed/undirected
  @Parameters
  public static Collection<Object[]> parameters() {
    return Arrays.asList(new Object[][] {{EdgeType.UNDIRECTED}, {EdgeType.DIRECTED}});

            

Reported by PMD.

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

Line: 61

                private static MutableNetwork<Integer, String> createNetwork(EdgeType edgeType) {
    switch (edgeType) {
      case UNDIRECTED:
        return NetworkBuilder.undirected().allowsSelfLoops(true).build();
      case DIRECTED:
        return NetworkBuilder.directed().allowsSelfLoops(true).build();
      default:
        throw new IllegalStateException("Unexpected edge type: " + edgeType);
    }

            

Reported by PMD.

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

Line: 61

                private static MutableNetwork<Integer, String> createNetwork(EdgeType edgeType) {
    switch (edgeType) {
      case UNDIRECTED:
        return NetworkBuilder.undirected().allowsSelfLoops(true).build();
      case DIRECTED:
        return NetworkBuilder.directed().allowsSelfLoops(true).build();
      default:
        throw new IllegalStateException("Unexpected edge type: " + edgeType);
    }

            

Reported by PMD.

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

Line: 63

                    case UNDIRECTED:
        return NetworkBuilder.undirected().allowsSelfLoops(true).build();
      case DIRECTED:
        return NetworkBuilder.directed().allowsSelfLoops(true).build();
      default:
        throw new IllegalStateException("Unexpected edge type: " + edgeType);
    }
  }


            

Reported by PMD.

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

Line: 63

                    case UNDIRECTED:
        return NetworkBuilder.undirected().allowsSelfLoops(true).build();
      case DIRECTED:
        return NetworkBuilder.directed().allowsSelfLoops(true).build();
      default:
        throw new IllegalStateException("Unexpected edge type: " + edgeType);
    }
  }


            

Reported by PMD.

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

Line: 85

                  network.addNode(N1);

    MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
    g2.addNode(N2);

    assertThat(network).isNotEqualTo(g2);
  }

  // Node sets are the same, but edge sets differ.

            

Reported by PMD.

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

Line: 87

                  MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
    g2.addNode(N2);

    assertThat(network).isNotEqualTo(g2);
  }

  // Node sets are the same, but edge sets differ.
  @Test
  public void equivalent_edgeSetsDiffer() {

            

Reported by PMD.

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

Line: 96

                  network.addEdge(N1, N2, E12);

    MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
    g2.addEdge(N1, N2, E13);

    assertThat(network).isNotEqualTo(g2);
  }

  // Node/edge sets are the same, but node/edge connections differ due to edge type.

            

Reported by PMD.

guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java
33 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 40

                private TreeMultimap<String, Integer> createMultimap() {
    TreeMultimap<String, Integer> multimap =
        TreeMultimap.create(
            Ordering.<String>natural().nullsFirst(), Ordering.<Integer>natural().nullsFirst());
    multimap.put("a", -1);
    multimap.put("a", -3);
    multimap.put("z", -2);
    return multimap;
  }

            

Reported by PMD.

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

Line: 40

                private TreeMultimap<String, Integer> createMultimap() {
    TreeMultimap<String, Integer> multimap =
        TreeMultimap.create(
            Ordering.<String>natural().nullsFirst(), Ordering.<Integer>natural().nullsFirst());
    multimap.put("a", -1);
    multimap.put("a", -3);
    multimap.put("z", -2);
    return multimap;
  }

            

Reported by PMD.

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

Line: 40

                private TreeMultimap<String, Integer> createMultimap() {
    TreeMultimap<String, Integer> multimap =
        TreeMultimap.create(
            Ordering.<String>natural().nullsFirst(), Ordering.<Integer>natural().nullsFirst());
    multimap.put("a", -1);
    multimap.put("a", -3);
    multimap.put("z", -2);
    return multimap;
  }

            

Reported by PMD.

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

Line: 40

                private TreeMultimap<String, Integer> createMultimap() {
    TreeMultimap<String, Integer> multimap =
        TreeMultimap.create(
            Ordering.<String>natural().nullsFirst(), Ordering.<Integer>natural().nullsFirst());
    multimap.put("a", -1);
    multimap.put("a", -3);
    multimap.put("z", -2);
    return multimap;
  }

            

Reported by PMD.

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

Line: 41

                  TreeMultimap<String, Integer> multimap =
        TreeMultimap.create(
            Ordering.<String>natural().nullsFirst(), Ordering.<Integer>natural().nullsFirst());
    multimap.put("a", -1);
    multimap.put("a", -3);
    multimap.put("z", -2);
    return multimap;
  }


            

Reported by PMD.

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

Line: 42

                      TreeMultimap.create(
            Ordering.<String>natural().nullsFirst(), Ordering.<Integer>natural().nullsFirst());
    multimap.put("a", -1);
    multimap.put("a", -3);
    multimap.put("z", -2);
    return multimap;
  }

  @Override

            

Reported by PMD.

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

Line: 43

                          Ordering.<String>natural().nullsFirst(), Ordering.<Integer>natural().nullsFirst());
    multimap.put("a", -1);
    multimap.put("a", -3);
    multimap.put("z", -2);
    return multimap;
  }

  @Override
  protected Map<String, Collection<Integer>> makeEmptyMap() {

            

Reported by PMD.

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

Line: 49

              
  @Override
  protected Map<String, Collection<Integer>> makeEmptyMap() {
    return createMultimap().asMap().subMap("e", "p");
  }

  @Override
  protected Map<String, Collection<Integer>> makePopulatedMap() {
    TreeMultimap<String, Integer> multimap = createMultimap();

            

Reported by PMD.

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

Line: 49

              
  @Override
  protected Map<String, Collection<Integer>> makeEmptyMap() {
    return createMultimap().asMap().subMap("e", "p");
  }

  @Override
  protected Map<String, Collection<Integer>> makePopulatedMap() {
    TreeMultimap<String, Integer> multimap = createMultimap();

            

Reported by PMD.

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

Line: 55

                @Override
  protected Map<String, Collection<Integer>> makePopulatedMap() {
    TreeMultimap<String, Integer> multimap = createMultimap();
    multimap.put("f", 1);
    multimap.put("f", 2);
    multimap.put("g", 3);
    multimap.put("h", 4);
    return multimap.asMap().subMap("e", "p");
  }

            

Reported by PMD.

guava-tests/test/com/google/common/io/MultiInputStreamTest.java
33 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: 34

               */
public class MultiInputStreamTest extends IoTestCase {

  public void testJoin() throws Exception {
    joinHelper(0);
    joinHelper(1);
    joinHelper(0, 0, 0);
    joinHelper(10, 20);
    joinHelper(10, 0, 20);

            

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

                  joinHelper(1, 0, 1, 0, 1, 0, 1, 0);
  }

  public void testOnlyOneOpen() throws Exception {
    final ByteSource source = newByteSource(0, 50);
    final int[] counter = new int[1];
    ByteSource checker =
        new ByteSource() {
          @Override

            

Reported by PMD.

Avoid assignments in operands
Error

Line: 54

                      new ByteSource() {
          @Override
          public InputStream openStream() throws IOException {
            if (counter[0]++ != 0) {
              throw new IllegalStateException("More than one source open");
            }
            return new FilterInputStream(source.openStream()) {
              @Override
              public void close() throws IOException {

            

Reported by PMD.

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

Line: 66

                          };
          }
        };
    byte[] result = ByteSource.concat(checker, checker, checker).read();
    assertEquals(150, result.length);
  }

  private void joinHelper(Integer... spans) throws Exception {
    List<ByteSource> sources = Lists.newArrayList();

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 70

                  assertEquals(150, result.length);
  }

  private void joinHelper(Integer... spans) throws Exception {
    List<ByteSource> sources = Lists.newArrayList();
    int start = 0;
    for (Integer span : spans) {
      sources.add(newByteSource(start, span));
      start += span;

            

Reported by PMD.

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

Line: 78

                    start += span;
    }
    ByteSource joined = ByteSource.concat(sources);
    assertTrue(newByteSource(0, start).contentEquals(joined));
  }

  public void testReadSingleByte() throws Exception {
    ByteSource source = newByteSource(0, 10);
    ByteSource joined = ByteSource.concat(source, source);

            

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

                  assertTrue(newByteSource(0, start).contentEquals(joined));
  }

  public void testReadSingleByte() throws Exception {
    ByteSource source = newByteSource(0, 10);
    ByteSource joined = ByteSource.concat(source, source);
    assertEquals(20, joined.size());
    InputStream in = joined.openStream();
    assertFalse(in.markSupported());

            

Reported by PMD.

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

Line: 81

                  assertTrue(newByteSource(0, start).contentEquals(joined));
  }

  public void testReadSingleByte() throws Exception {
    ByteSource source = newByteSource(0, 10);
    ByteSource joined = ByteSource.concat(source, source);
    assertEquals(20, joined.size());
    InputStream in = joined.openStream();
    assertFalse(in.markSupported());

            

Reported by PMD.

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

Line: 84

                public void testReadSingleByte() throws Exception {
    ByteSource source = newByteSource(0, 10);
    ByteSource joined = ByteSource.concat(source, source);
    assertEquals(20, joined.size());
    InputStream in = joined.openStream();
    assertFalse(in.markSupported());
    assertEquals(10, in.available());
    int total = 0;
    while (in.read() != -1) {

            

Reported by PMD.

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

Line: 85

                  ByteSource source = newByteSource(0, 10);
    ByteSource joined = ByteSource.concat(source, source);
    assertEquals(20, joined.size());
    InputStream in = joined.openStream();
    assertFalse(in.markSupported());
    assertEquals(10, in.available());
    int total = 0;
    while (in.read() != -1) {
      total++;

            

Reported by PMD.

guava-tests/benchmark/com/google/common/base/CharMatcherBenchmark.java
33 issues
Avoid really long classes.
Design

Line: 36

               * @author Kevin Bourrillion
 * @author David Richter
 */
public class CharMatcherBenchmark {

  // Caliper injects params automatically

  // Overall configuration
  @Param SampleMatcherConfig config;

            

Reported by PMD.

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

Line: 41

                // Caliper injects params automatically

  // Overall configuration
  @Param SampleMatcherConfig config;

  // Length of string to match against
  @Param({"64", "1024"})
  int length;


            

Reported by PMD.

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

Line: 45

              
  // Length of string to match against
  @Param({"64", "1024"})
  int length;

  // Percent of string that the CharMatcher matches
  @Param({"0", "10", "50", "100"})
  int percent;


            

Reported by PMD.

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

Line: 49

              
  // Percent of string that the CharMatcher matches
  @Param({"0", "10", "50", "100"})
  int percent;

  // Whether to use a precomputed CharMatcher
  @Param("true")
  boolean precomputed;


            

Reported by PMD.

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

Line: 53

              
  // Whether to use a precomputed CharMatcher
  @Param("true")
  boolean precomputed;

  enum Size {
    DEFAULT,
    SMALL;
  }

            

Reported by PMD.

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

Line: 60

                  SMALL;
  }

  @Param Size size;

  // Whether to ensure there is a matching character in the first position
  // to force the trimming code to run.
  @Param("false")
  boolean forceSlow;

            

Reported by PMD.

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

Line: 65

                // Whether to ensure there is a matching character in the first position
  // to force the trimming code to run.
  @Param("false")
  boolean forceSlow;

  // Use web-derived sampler.
  @Param("false")
  boolean web;


            

Reported by PMD.

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

Line: 69

              
  // Use web-derived sampler.
  @Param("false")
  boolean web;

  private CharMatcher matcher;
  private String string;

  // Caliper invokes setUp() after injecting params

            

Reported by PMD.

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

Line: 71

                @Param("false")
  boolean web;

  private CharMatcher matcher;
  private String string;

  // Caliper invokes setUp() after injecting params
  @BeforeExperiment
  void setUp() {

            

Reported by PMD.

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

Line: 72

                boolean web;

  private CharMatcher matcher;
  private String string;

  // Caliper invokes setUp() after injecting params
  @BeforeExperiment
  void setUp() {
    this.matcher = precomputed ? config.matcher.precomputed() : config.matcher;

            

Reported by PMD.

guava-tests/test/com/google/common/collect/MultisetsCollectionTest.java
33 issues
This class name ends with Test but contains no test cases
Error

Line: 43

               * @author Jared Levy
 */
@GwtIncompatible // suite // TODO(cpovirk): set up collect/gwt/suites version
public class MultisetsCollectionTest extends TestCase {
  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())

            

Reported by PMD.

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

Line: 44

               */
@GwtIncompatible // suite // TODO(cpovirk): set up collect/gwt/suites version
public class MultisetsCollectionTest extends TestCase {
  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())
            .withFeatures(

            

Reported by PMD.

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

Line: 48

                  TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.SERIALIZABLE,
                CollectionFeature.ALLOWS_NULL_QUERIES)

            

Reported by PMD.

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

Line: 48

                  TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.SERIALIZABLE,
                CollectionFeature.ALLOWS_NULL_QUERIES)

            

Reported by PMD.

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

Line: 48

                  TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.SERIALIZABLE,
                CollectionFeature.ALLOWS_NULL_QUERIES)

            

Reported by PMD.

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

Line: 58

                          .createTestSuite());

    suite.addTest(
        SortedMultisetTestSuiteBuilder.using(unmodifiableSortedMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.ALLOWS_NULL_QUERIES)
            .named("Multisets.unmodifiableMultiset[TreeMultiset]")

            

Reported by PMD.

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

Line: 58

                          .createTestSuite());

    suite.addTest(
        SortedMultisetTestSuiteBuilder.using(unmodifiableSortedMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.ALLOWS_NULL_QUERIES)
            .named("Multisets.unmodifiableMultiset[TreeMultiset]")

            

Reported by PMD.

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

Line: 58

                          .createTestSuite());

    suite.addTest(
        SortedMultisetTestSuiteBuilder.using(unmodifiableSortedMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.ALLOWS_NULL_QUERIES)
            .named("Multisets.unmodifiableMultiset[TreeMultiset]")

            

Reported by PMD.

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

Line: 67

                          .createTestSuite());

    suite.addTest(
        MultisetTestSuiteBuilder.using(unionGenerator())
            .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES)
            .named("Multisets.union")
            .createTestSuite());

    suite.addTest(

            

Reported by PMD.

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

Line: 67

                          .createTestSuite());

    suite.addTest(
        MultisetTestSuiteBuilder.using(unionGenerator())
            .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES)
            .named("Multisets.union")
            .createTestSuite());

    suite.addTest(

            

Reported by PMD.

android/guava/src/com/google/common/cache/CacheBuilderSpec.java
33 issues
The class 'CacheBuilderSpec' has a Modified Cyclomatic Complexity of 3 (Highest = 13).
Design

Line: 84

              @SuppressWarnings("GoodTime") // lots of violations (nanosecond math)
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class CacheBuilderSpec {
  /** Parses a single value. */
  private interface ValueParser {
    void parse(CacheBuilderSpec spec, String key, @CheckForNull String value);
  }


            

Reported by PMD.

The class 'CacheBuilderSpec' has a Standard Cyclomatic Complexity of 3 (Highest = 14).
Design

Line: 84

              @SuppressWarnings("GoodTime") // lots of violations (nanosecond math)
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class CacheBuilderSpec {
  /** Parses a single value. */
  private interface ValueParser {
    void parse(CacheBuilderSpec spec, String key, @CheckForNull String value);
  }


            

Reported by PMD.

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

Line: 113

                        .put("refreshInterval", new RefreshDurationParser())
          .build();

  @VisibleForTesting @CheckForNull Integer initialCapacity;
  @VisibleForTesting @CheckForNull Long maximumSize;
  @VisibleForTesting @CheckForNull Long maximumWeight;
  @VisibleForTesting @CheckForNull Integer concurrencyLevel;
  @VisibleForTesting @CheckForNull Strength keyStrength;
  @VisibleForTesting @CheckForNull Strength valueStrength;

            

Reported by PMD.

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

Line: 114

                        .build();

  @VisibleForTesting @CheckForNull Integer initialCapacity;
  @VisibleForTesting @CheckForNull Long maximumSize;
  @VisibleForTesting @CheckForNull Long maximumWeight;
  @VisibleForTesting @CheckForNull Integer concurrencyLevel;
  @VisibleForTesting @CheckForNull Strength keyStrength;
  @VisibleForTesting @CheckForNull Strength valueStrength;
  @VisibleForTesting @CheckForNull Boolean recordStats;

            

Reported by PMD.

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

Line: 115

              
  @VisibleForTesting @CheckForNull Integer initialCapacity;
  @VisibleForTesting @CheckForNull Long maximumSize;
  @VisibleForTesting @CheckForNull Long maximumWeight;
  @VisibleForTesting @CheckForNull Integer concurrencyLevel;
  @VisibleForTesting @CheckForNull Strength keyStrength;
  @VisibleForTesting @CheckForNull Strength valueStrength;
  @VisibleForTesting @CheckForNull Boolean recordStats;
  @VisibleForTesting long writeExpirationDuration;

            

Reported by PMD.

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

Line: 116

                @VisibleForTesting @CheckForNull Integer initialCapacity;
  @VisibleForTesting @CheckForNull Long maximumSize;
  @VisibleForTesting @CheckForNull Long maximumWeight;
  @VisibleForTesting @CheckForNull Integer concurrencyLevel;
  @VisibleForTesting @CheckForNull Strength keyStrength;
  @VisibleForTesting @CheckForNull Strength valueStrength;
  @VisibleForTesting @CheckForNull Boolean recordStats;
  @VisibleForTesting long writeExpirationDuration;
  @VisibleForTesting @CheckForNull TimeUnit writeExpirationTimeUnit;

            

Reported by PMD.

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

Line: 117

                @VisibleForTesting @CheckForNull Long maximumSize;
  @VisibleForTesting @CheckForNull Long maximumWeight;
  @VisibleForTesting @CheckForNull Integer concurrencyLevel;
  @VisibleForTesting @CheckForNull Strength keyStrength;
  @VisibleForTesting @CheckForNull Strength valueStrength;
  @VisibleForTesting @CheckForNull Boolean recordStats;
  @VisibleForTesting long writeExpirationDuration;
  @VisibleForTesting @CheckForNull TimeUnit writeExpirationTimeUnit;
  @VisibleForTesting long accessExpirationDuration;

            

Reported by PMD.

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

Line: 118

                @VisibleForTesting @CheckForNull Long maximumWeight;
  @VisibleForTesting @CheckForNull Integer concurrencyLevel;
  @VisibleForTesting @CheckForNull Strength keyStrength;
  @VisibleForTesting @CheckForNull Strength valueStrength;
  @VisibleForTesting @CheckForNull Boolean recordStats;
  @VisibleForTesting long writeExpirationDuration;
  @VisibleForTesting @CheckForNull TimeUnit writeExpirationTimeUnit;
  @VisibleForTesting long accessExpirationDuration;
  @VisibleForTesting @CheckForNull TimeUnit accessExpirationTimeUnit;

            

Reported by PMD.

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

Line: 119

                @VisibleForTesting @CheckForNull Integer concurrencyLevel;
  @VisibleForTesting @CheckForNull Strength keyStrength;
  @VisibleForTesting @CheckForNull Strength valueStrength;
  @VisibleForTesting @CheckForNull Boolean recordStats;
  @VisibleForTesting long writeExpirationDuration;
  @VisibleForTesting @CheckForNull TimeUnit writeExpirationTimeUnit;
  @VisibleForTesting long accessExpirationDuration;
  @VisibleForTesting @CheckForNull TimeUnit accessExpirationTimeUnit;
  @VisibleForTesting long refreshDuration;

            

Reported by PMD.

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

Line: 120

                @VisibleForTesting @CheckForNull Strength keyStrength;
  @VisibleForTesting @CheckForNull Strength valueStrength;
  @VisibleForTesting @CheckForNull Boolean recordStats;
  @VisibleForTesting long writeExpirationDuration;
  @VisibleForTesting @CheckForNull TimeUnit writeExpirationTimeUnit;
  @VisibleForTesting long accessExpirationDuration;
  @VisibleForTesting @CheckForNull TimeUnit accessExpirationTimeUnit;
  @VisibleForTesting long refreshDuration;
  @VisibleForTesting @CheckForNull TimeUnit refreshTimeUnit;

            

Reported by PMD.

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

Line: 64

              @Beta
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Stats implements Serializable {

  private final long count;
  private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;

            

Reported by PMD.

Field count has the same name as a method
Error

Line: 66

              @ElementTypesAreNonnullByDefault
public final class Stats implements Serializable {

  private final long count;
  private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;
  private final double max;


            

Reported by PMD.

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

Line: 66

              @ElementTypesAreNonnullByDefault
public final class Stats implements Serializable {

  private final long count;
  private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;
  private final double max;


            

Reported by PMD.

Field mean has the same name as a method
Error

Line: 67

              public final class Stats implements Serializable {

  private final long count;
  private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;
  private final double max;

  /**

            

Reported by PMD.

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

Line: 67

              public final class Stats implements Serializable {

  private final long count;
  private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;
  private final double max;

  /**

            

Reported by PMD.

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

Line: 68

              
  private final long count;
  private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;
  private final double max;

  /**
   * Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.

            

Reported by PMD.

Field sumOfSquaresOfDeltas has the same name as a method
Error

Line: 68

              
  private final long count;
  private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;
  private final double max;

  /**
   * Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.

            

Reported by PMD.

Field min has the same name as a method
Error

Line: 69

                private final long count;
  private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;
  private final double max;

  /**
   * Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.
   *

            

Reported by PMD.

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

Line: 69

                private final long count;
  private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;
  private final double max;

  /**
   * Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.
   *

            

Reported by PMD.

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

Line: 70

                private final double mean;
  private final double sumOfSquaresOfDeltas;
  private final double min;
  private final double max;

  /**
   * Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.
   *
   * <p>To ensure that the created instance obeys its contract, the parameters should satisfy the

            

Reported by PMD.

android/guava-tests/test/com/google/common/graph/NetworkEquivalenceTest.java
33 issues
This class has too many methods, consider refactoring it.
Design

Line: 34

              @AndroidIncompatible
// TODO(cpovirk): Figure out Android JUnit 4 support. Does it work with Gingerbread? @RunWith?
@RunWith(Parameterized.class)
public final class NetworkEquivalenceTest {
  private static final Integer N1 = 1;
  private static final Integer N2 = 2;
  private static final Integer N3 = 3;

  private static final String E11 = "1-1";

            

Reported by PMD.

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

Line: 44

                private static final String E12_A = "1-2a";
  private static final String E13 = "1-3";

  private final EdgeType edgeType;
  private final MutableNetwork<Integer, String> network;

  // add parameters: directed/undirected
  @Parameters
  public static Collection<Object[]> parameters() {

            

Reported by PMD.

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

Line: 45

                private static final String E13 = "1-3";

  private final EdgeType edgeType;
  private final MutableNetwork<Integer, String> network;

  // add parameters: directed/undirected
  @Parameters
  public static Collection<Object[]> parameters() {
    return Arrays.asList(new Object[][] {{EdgeType.UNDIRECTED}, {EdgeType.DIRECTED}});

            

Reported by PMD.

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

Line: 61

                private static MutableNetwork<Integer, String> createNetwork(EdgeType edgeType) {
    switch (edgeType) {
      case UNDIRECTED:
        return NetworkBuilder.undirected().allowsSelfLoops(true).build();
      case DIRECTED:
        return NetworkBuilder.directed().allowsSelfLoops(true).build();
      default:
        throw new IllegalStateException("Unexpected edge type: " + edgeType);
    }

            

Reported by PMD.

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

Line: 61

                private static MutableNetwork<Integer, String> createNetwork(EdgeType edgeType) {
    switch (edgeType) {
      case UNDIRECTED:
        return NetworkBuilder.undirected().allowsSelfLoops(true).build();
      case DIRECTED:
        return NetworkBuilder.directed().allowsSelfLoops(true).build();
      default:
        throw new IllegalStateException("Unexpected edge type: " + edgeType);
    }

            

Reported by PMD.

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

Line: 63

                    case UNDIRECTED:
        return NetworkBuilder.undirected().allowsSelfLoops(true).build();
      case DIRECTED:
        return NetworkBuilder.directed().allowsSelfLoops(true).build();
      default:
        throw new IllegalStateException("Unexpected edge type: " + edgeType);
    }
  }


            

Reported by PMD.

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

Line: 63

                    case UNDIRECTED:
        return NetworkBuilder.undirected().allowsSelfLoops(true).build();
      case DIRECTED:
        return NetworkBuilder.directed().allowsSelfLoops(true).build();
      default:
        throw new IllegalStateException("Unexpected edge type: " + edgeType);
    }
  }


            

Reported by PMD.

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

Line: 85

                  network.addNode(N1);

    MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
    g2.addNode(N2);

    assertThat(network).isNotEqualTo(g2);
  }

  // Node sets are the same, but edge sets differ.

            

Reported by PMD.

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

Line: 87

                  MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
    g2.addNode(N2);

    assertThat(network).isNotEqualTo(g2);
  }

  // Node sets are the same, but edge sets differ.
  @Test
  public void equivalent_edgeSetsDiffer() {

            

Reported by PMD.

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

Line: 96

                  network.addEdge(N1, N2, E12);

    MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
    g2.addEdge(N1, N2, E13);

    assertThat(network).isNotEqualTo(g2);
  }

  // Node/edge sets are the same, but node/edge connections differ due to edge type.

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/MultisetsCollectionTest.java
33 issues
This class name ends with Test but contains no test cases
Error

Line: 43

               * @author Jared Levy
 */
@GwtIncompatible // suite // TODO(cpovirk): set up collect/gwt/suites version
public class MultisetsCollectionTest extends TestCase {
  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())

            

Reported by PMD.

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

Line: 44

               */
@GwtIncompatible // suite // TODO(cpovirk): set up collect/gwt/suites version
public class MultisetsCollectionTest extends TestCase {
  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())
            .withFeatures(

            

Reported by PMD.

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

Line: 48

                  TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.SERIALIZABLE,
                CollectionFeature.ALLOWS_NULL_QUERIES)

            

Reported by PMD.

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

Line: 48

                  TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.SERIALIZABLE,
                CollectionFeature.ALLOWS_NULL_QUERIES)

            

Reported by PMD.

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

Line: 48

                  TestSuite suite = new TestSuite();

    suite.addTest(
        MultisetTestSuiteBuilder.using(unmodifiableMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.SERIALIZABLE,
                CollectionFeature.ALLOWS_NULL_QUERIES)

            

Reported by PMD.

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

Line: 58

                          .createTestSuite());

    suite.addTest(
        SortedMultisetTestSuiteBuilder.using(unmodifiableSortedMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.ALLOWS_NULL_QUERIES)
            .named("Multisets.unmodifiableMultiset[TreeMultiset]")

            

Reported by PMD.

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

Line: 58

                          .createTestSuite());

    suite.addTest(
        SortedMultisetTestSuiteBuilder.using(unmodifiableSortedMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.ALLOWS_NULL_QUERIES)
            .named("Multisets.unmodifiableMultiset[TreeMultiset]")

            

Reported by PMD.

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

Line: 58

                          .createTestSuite());

    suite.addTest(
        SortedMultisetTestSuiteBuilder.using(unmodifiableSortedMultisetGenerator())
            .withFeatures(
                CollectionSize.ANY,
                CollectionFeature.KNOWN_ORDER,
                CollectionFeature.ALLOWS_NULL_QUERIES)
            .named("Multisets.unmodifiableMultiset[TreeMultiset]")

            

Reported by PMD.

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

Line: 67

                          .createTestSuite());

    suite.addTest(
        MultisetTestSuiteBuilder.using(unionGenerator())
            .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES)
            .named("Multisets.union")
            .createTestSuite());

    suite.addTest(

            

Reported by PMD.

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

Line: 67

                          .createTestSuite());

    suite.addTest(
        MultisetTestSuiteBuilder.using(unionGenerator())
            .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES)
            .named("Multisets.union")
            .createTestSuite());

    suite.addTest(

            

Reported by PMD.

android/guava-tests/benchmark/com/google/common/base/CharMatcherBenchmark.java
33 issues
Avoid really long classes.
Design

Line: 36

               * @author Kevin Bourrillion
 * @author David Richter
 */
public class CharMatcherBenchmark {

  // Caliper injects params automatically

  // Overall configuration
  @Param SampleMatcherConfig config;

            

Reported by PMD.

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

Line: 41

                // Caliper injects params automatically

  // Overall configuration
  @Param SampleMatcherConfig config;

  // Length of string to match against
  @Param({"64", "1024"})
  int length;


            

Reported by PMD.

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

Line: 45

              
  // Length of string to match against
  @Param({"64", "1024"})
  int length;

  // Percent of string that the CharMatcher matches
  @Param({"0", "10", "50", "100"})
  int percent;


            

Reported by PMD.

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

Line: 49

              
  // Percent of string that the CharMatcher matches
  @Param({"0", "10", "50", "100"})
  int percent;

  // Whether to use a precomputed CharMatcher
  @Param("true")
  boolean precomputed;


            

Reported by PMD.

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

Line: 53

              
  // Whether to use a precomputed CharMatcher
  @Param("true")
  boolean precomputed;

  enum Size {
    DEFAULT,
    SMALL;
  }

            

Reported by PMD.

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

Line: 60

                  SMALL;
  }

  @Param Size size;

  // Whether to ensure there is a matching character in the first position
  // to force the trimming code to run.
  @Param("false")
  boolean forceSlow;

            

Reported by PMD.

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

Line: 65

                // Whether to ensure there is a matching character in the first position
  // to force the trimming code to run.
  @Param("false")
  boolean forceSlow;

  // Use web-derived sampler.
  @Param("false")
  boolean web;


            

Reported by PMD.

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

Line: 69

              
  // Use web-derived sampler.
  @Param("false")
  boolean web;

  private CharMatcher matcher;
  private String string;

  // Caliper invokes setUp() after injecting params

            

Reported by PMD.

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

Line: 71

                @Param("false")
  boolean web;

  private CharMatcher matcher;
  private String string;

  // Caliper invokes setUp() after injecting params
  @BeforeExperiment
  void setUp() {

            

Reported by PMD.

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

Line: 72

                boolean web;

  private CharMatcher matcher;
  private String string;

  // Caliper invokes setUp() after injecting params
  @BeforeExperiment
  void setUp() {
    this.matcher = precomputed ? config.matcher.precomputed() : config.matcher;

            

Reported by PMD.