The following issues were found
android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java
3 issues
Line: 39
@Override
protected Map<String, Collection<Integer>> makeEmptyMap() {
return ImmutableSetMultimap.<String, Integer>of().asMap();
}
@Override
protected Map<String, Collection<Integer>> makePopulatedMap() {
Multimap<String, Integer> delegate = HashMultimap.create();
Reported by PMD.
Line: 39
@Override
protected Map<String, Collection<Integer>> makeEmptyMap() {
return ImmutableSetMultimap.<String, Integer>of().asMap();
}
@Override
protected Map<String, Collection<Integer>> makePopulatedMap() {
Multimap<String, Integer> delegate = HashMultimap.create();
Reported by PMD.
Line: 46
protected Map<String, Collection<Integer>> makePopulatedMap() {
Multimap<String, Integer> delegate = HashMultimap.create();
populate(delegate);
return ImmutableSetMultimap.copyOf(delegate).asMap();
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java
3 issues
Line: 40
@Override
protected SortedMap<String, String> makePopulatedMap() {
SortedMap<String, Integer> underlying = Maps.newTreeMap();
underlying.put("a", 1);
underlying.put("b", 2);
underlying.put("c", 3);
return Maps.transformValues(underlying, Functions.toStringFunction());
}
}
Reported by PMD.
Line: 41
protected SortedMap<String, String> makePopulatedMap() {
SortedMap<String, Integer> underlying = Maps.newTreeMap();
underlying.put("a", 1);
underlying.put("b", 2);
underlying.put("c", 3);
return Maps.transformValues(underlying, Functions.toStringFunction());
}
}
Reported by PMD.
Line: 42
SortedMap<String, Integer> underlying = Maps.newTreeMap();
underlying.put("a", 1);
underlying.put("b", 2);
underlying.put("c", 3);
return Maps.transformValues(underlying, Functions.toStringFunction());
}
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapReplaceValuesTester.java
3 issues
Line: 35
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListMultimapReplaceValuesTester<K, V> extends AbstractListMultimapTester<K, V> {
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceValuesPreservesOrder() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v3(), v1(), v4());
for (K k : sampleKeys()) {
Reported by PMD.
Line: 42
for (K k : sampleKeys()) {
resetContainer();
multimap().replaceValues(k, values);
assertGet(k, values);
}
}
}
Reported by PMD.
Line: 38
@MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
public void testReplaceValuesPreservesOrder() {
@SuppressWarnings("unchecked")
List<V> values = Arrays.asList(v3(), v1(), v4());
for (K k : sampleKeys()) {
resetContainer();
multimap().replaceValues(k, values);
assertGet(k, values);
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapEqualsTester.java
3 issues
Line: 34
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListMultimapEqualsTester<K, V> extends AbstractListMultimapTester<K, V> {
@CollectionSize.Require(SEVERAL)
public void testOrderingAffectsEqualsComparisons() {
ListMultimap<K, V> multimap1 =
getSubjectGenerator()
.create(
Helpers.mapEntry(k0(), v0()),
Reported by PMD.
Line: 37
@CollectionSize.Require(SEVERAL)
public void testOrderingAffectsEqualsComparisons() {
ListMultimap<K, V> multimap1 =
getSubjectGenerator()
.create(
Helpers.mapEntry(k0(), v0()),
Helpers.mapEntry(k0(), v1()),
Helpers.mapEntry(k0(), v0()));
ListMultimap<K, V> multimap2 =
Reported by PMD.
Line: 43
Helpers.mapEntry(k0(), v1()),
Helpers.mapEntry(k0(), v0()));
ListMultimap<K, V> multimap2 =
getSubjectGenerator()
.create(
Helpers.mapEntry(k0(), v1()),
Helpers.mapEntry(k0(), v0()),
Helpers.mapEntry(k0(), v0()));
new EqualsTester().addEqualityGroup(multimap1).addEqualityGroup(multimap2).testEquals();
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/BiMapTestSuiteBuilder.java
3 issues
Line: 109
.withSetUp(parentBuilder.getSetUp())
.withTearDown(parentBuilder.getTearDown())
.createTestSuite());
if (!parentBuilder.getFeatures().contains(NoRecurse.INVERSE)) {
derived.add(
BiMapTestSuiteBuilder.using(
new InverseBiMapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
.withFeatures(computeInverseFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " inverse")
Reported by PMD.
Line: 148
private static Set<Feature<?>> computeValuesSetFeatures(Set<Feature<?>> mapFeatures) {
Set<Feature<?>> valuesCollectionFeatures = computeCommonDerivedCollectionFeatures(mapFeatures);
valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_QUERIES);
if (mapFeatures.contains(MapFeature.ALLOWS_NULL_VALUES)) {
valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_VALUES);
}
Reported by PMD.
Line: 154
valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_VALUES);
}
valuesCollectionFeatures.add(CollectionFeature.REJECTS_DUPLICATES_AT_CREATION);
return valuesCollectionFeatures;
}
private static Set<Feature<?>> computeCommonDerivedCollectionFeatures(
Reported by PMD.
android/guava-tests/test/com/google/common/eventbus/PackageSanityTests.java
3 issues
Line: 31
public class PackageSanityTests extends AbstractPackageSanityTests {
public PackageSanityTests() throws Exception {
DummySubscriber dummySubscriber = new DummySubscriber();
setDefault(Subscriber.class, dummySubscriber.toSubscriber());
setDefault(Method.class, DummySubscriber.subscriberMethod());
setDefault(SubscriberExceptionContext.class, dummySubscriber.toContext());
setDefault(Dispatcher.class, Dispatcher.immediate());
Reported by PMD.
Line: 41
private static class DummySubscriber {
private final EventBus eventBus = new EventBus();
@Subscribe
public void handle(@NullableDecl Object anything) {}
Subscriber toSubscriber() throws Exception {
Reported by PMD.
Line: 46
@Subscribe
public void handle(@NullableDecl Object anything) {}
Subscriber toSubscriber() throws Exception {
return Subscriber.create(eventBus, this, subscriberMethod());
}
SubscriberExceptionContext toContext() {
return new SubscriberExceptionContext(eventBus, new Object(), this, subscriberMethod());
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java
3 issues
Line: 32
*/
@GwtCompatible
public abstract class TestMapEntrySetGenerator<K, V> implements TestSetGenerator<Map.Entry<K, V>> {
private final SampleElements<K> keys;
private final SampleElements<V> values;
protected TestMapEntrySetGenerator(SampleElements<K> keys, SampleElements<V> values) {
this.keys = keys;
this.values = values;
Reported by PMD.
Line: 33
@GwtCompatible
public abstract class TestMapEntrySetGenerator<K, V> implements TestSetGenerator<Map.Entry<K, V>> {
private final SampleElements<K> keys;
private final SampleElements<V> values;
protected TestMapEntrySetGenerator(SampleElements<K> keys, SampleElements<V> values) {
this.keys = keys;
this.values = values;
}
Reported by PMD.
Line: 52
return createFromEntries(entries);
}
public abstract Set<Entry<K, V>> createFromEntries(Entry<K, V>[] entries);
@Override
@SuppressWarnings("unchecked") // generic arrays make typesafety sad
public Entry<K, V>[] createArray(int length) {
return new Entry[length];
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java
3 issues
Line: 35
* @author Louis Wasserman
*/
@GwtIncompatible
public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> {
@SuppressWarnings("unchecked")
private static final Comparator<Object> NATURAL_ORDER =
new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
Reported by PMD.
Line: 45
}
};
private final NavigableSet<E> delegate;
public SafeTreeSet() {
this(new TreeSet<E>());
}
Reported by PMD.
Line: 235
// a ClassCastException is what's supposed to happen!
@SuppressWarnings("unchecked")
E e = (E) t;
comparator().compare(e, e);
return t;
}
@Override
public boolean equals(Object obj) {
Reported by PMD.
android/guava-tests/test/com/google/common/io/TestByteSink.java
3 issues
Line: 32
public class TestByteSink extends ByteSink implements TestStreamSupplier {
private final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
private final ImmutableSet<TestOption> options;
private boolean outputStreamOpened;
private boolean outputStreamClosed;
public TestByteSink(TestOption... options) {
Reported by PMD.
Line: 34
private final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
private final ImmutableSet<TestOption> options;
private boolean outputStreamOpened;
private boolean outputStreamClosed;
public TestByteSink(TestOption... options) {
this.options = ImmutableSet.copyOf(options);
}
Reported by PMD.
Line: 35
private final ImmutableSet<TestOption> options;
private boolean outputStreamOpened;
private boolean outputStreamClosed;
public TestByteSink(TestOption... options) {
this.options = ImmutableSet.copyOf(options);
}
Reported by PMD.
android/guava-tests/test/com/google/common/io/TestInputStream.java
3 issues
Line: 34
/** @author Colin Decker */
public class TestInputStream extends FilterInputStream {
private final ImmutableSet<TestOption> options;
private boolean closed;
public TestInputStream(InputStream in, TestOption... options) throws IOException {
this(in, Arrays.asList(options));
}
Reported by PMD.
Line: 35
public class TestInputStream extends FilterInputStream {
private final ImmutableSet<TestOption> options;
private boolean closed;
public TestInputStream(InputStream in, TestOption... options) throws IOException {
this(in, Arrays.asList(options));
}
Reported by PMD.
Line: 35
public class TestInputStream extends FilterInputStream {
private final ImmutableSet<TestOption> options;
private boolean closed;
public TestInputStream(InputStream in, TestOption... options) throws IOException {
this(in, Arrays.asList(options));
}
Reported by PMD.