The following issues were found
guava-testlib/src/com/google/common/collect/testing/DerivedTestIteratorGenerator.java
2 issues
Line: 30
@GwtCompatible
public final class DerivedTestIteratorGenerator<E>
implements TestIteratorGenerator<E>, DerivedGenerator {
private final TestSubjectGenerator<? extends Iterable<E>> collectionGenerator;
public DerivedTestIteratorGenerator(
TestSubjectGenerator<? extends Iterable<E>> collectionGenerator) {
this.collectionGenerator = collectionGenerator;
}
Reported by PMD.
Line: 44
@Override
public Iterator<E> get() {
return collectionGenerator.createTestSubject().iterator();
}
}
Reported by PMD.
android/guava/src/com/google/common/collect/HashBasedTable.java
2 issues
Line: 53
@ElementTypesAreNonnullByDefault
public class HashBasedTable<R, C, V> extends StandardTable<R, C, V> {
private static class Factory<C, V> implements Supplier<Map<C, V>>, Serializable {
final int expectedSize;
Factory(int expectedSize) {
this.expectedSize = expectedSize;
}
Reported by PMD.
Line: 97
public static <R, C, V> HashBasedTable<R, C, V> create(
Table<? extends R, ? extends C, ? extends V> table) {
HashBasedTable<R, C, V> result = create();
result.putAll(table);
return result;
}
HashBasedTable(Map<R, Map<C, V>> backingMap, Factory<C, V> factory) {
super(backingMap, factory);
Reported by PMD.
android/guava/src/com/google/common/collect/ForwardingSet.java
2 issues
Line: 63
@Override
public boolean equals(@CheckForNull Object object) {
return object == this || delegate().equals(object);
}
@Override
public int hashCode() {
return delegate().hashCode();
Reported by PMD.
Line: 68
@Override
public int hashCode() {
return delegate().hashCode();
}
/**
* A sensible definition of {@link #removeAll} in terms of {@link #iterator} and {@link #remove}.
* If you override {@code iterator} or {@code remove}, you may wish to override {@link #removeAll}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/MinimalSet.java
2 issues
Line: 34
* @author Regina O'Dell
*/
@GwtCompatible
public class MinimalSet<E> extends MinimalCollection<E> implements Set<E> {
@SuppressWarnings("unchecked") // empty Object[] as E[]
public static <E> MinimalSet<E> of(E... contents) {
return ofClassAndContents(Object.class, (E[]) new Object[0], Arrays.asList(contents));
}
Reported by PMD.
Line: 69
public boolean equals(Object object) {
if (object instanceof Set) {
Set<?> that = (Set<?>) object;
return (this.size() == that.size()) && this.containsAll(that);
}
return false;
}
@Override
Reported by PMD.
android/guava/src/com/google/common/collect/ForwardingImmutableCollection.java
2 issues
Line: 28
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
class ForwardingImmutableCollection {
private ForwardingImmutableCollection() {}
}
Reported by PMD.
Line: 28
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
class ForwardingImmutableCollection {
private ForwardingImmutableCollection() {}
}
Reported by PMD.
android/guava/src/com/google/common/collect/Count.java
2 issues
Line: 28
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
final class Count implements Serializable {
private int value;
Count(int value) {
this.value = value;
}
Reported by PMD.
Line: 29
@GwtCompatible
@ElementTypesAreNonnullByDefault
final class Count implements Serializable {
private int value;
Count(int value) {
this.value = value;
}
Reported by PMD.
android/guava/src/com/google/common/collect/CompoundOrdering.java
2 issues
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.
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.
android/guava-tests/test/com/google/common/util/concurrent/ServiceTest.java
2 issues
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.
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.
android/guava-tests/test/com/google/common/util/concurrent/RunnablesTest.java
2 issues
Line: 29
*/
@GwtCompatible
public class RunnablesTest extends TestCase {
public void testDoNothingRunnableIsSingleton() {
assertSame(Runnables.doNothing(), Runnables.doNothing());
}
}
Reported by PMD.
Line: 30
@GwtCompatible
public class RunnablesTest extends TestCase {
public void testDoNothingRunnableIsSingleton() {
assertSame(Runnables.doNothing(), Runnables.doNothing());
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/ForwardingListeningExecutorServiceTest.java
2 issues
Line: 23
/** Unit tests for {@link ForwardingListeningExecutorService} */
public class ForwardingListeningExecutorServiceTest extends TestCase {
public void testForwarding() {
ForwardingObjectTester.testForwardingObject(ForwardingListeningExecutorService.class);
}
}
Reported by PMD.
Line: 23
/** Unit tests for {@link ForwardingListeningExecutorService} */
public class ForwardingListeningExecutorServiceTest extends TestCase {
public void testForwarding() {
ForwardingObjectTester.testForwardingObject(ForwardingListeningExecutorService.class);
}
}
Reported by PMD.