The following issues were found
guava/src/com/google/common/collect/UsingToStringOrdering.java
1 issues
Line: 30
@Override
public int compare(Object left, Object right) {
return left.toString().compareTo(right.toString());
}
// preserve singleton-ness, so equals() and hashCode() work correctly
private Object readResolve() {
return INSTANCE;
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/UncheckedThrowingFuture.java
1 issues
Line: 67
}
}
private static final class WrapperException extends Exception {
WrapperException(Throwable t) {
super(t);
}
}
Reported by PMD.
guava/src/com/google/common/util/concurrent/ExecutionError.java
1 issues
Line: 32
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
public class ExecutionError extends Error {
/*
* Ideally, this class would have exposed only constructors that require a non-null cause. We
* might try to move in that direction, but there are complications. See
* https://github.com/jspecify/nullness-checker-for-checker-framework/blob/61aafa4ae52594830cfc2d61c8b113009dbdb045/src/main/java/com/google/jspecify/nullness/NullSpecTransfer.java#L789
*/
Reported by PMD.
guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java
1 issues
Line: 33
* <p>TODO(cpovirk): Consider applying this subclass approach to our other types.
*/
@GwtCompatible(emulated = true)
abstract class HashMultimapGwtSerializationDependencies<K, V> extends AbstractSetMultimap<K, V> {
HashMultimapGwtSerializationDependencies(Map<K, Collection<V>> map) {
super(map);
}
}
Reported by PMD.
guava/src/com/google/common/collect/Hashing.java
1 issues
Line: 60
private static final int MAX_TABLE_SIZE = Ints.MAX_POWER_OF_TWO;
static int closedTableSize(int expectedEntries, double loadFactor) {
// Get the recommended table size.
// Round down to the nearest power of 2.
expectedEntries = Math.max(expectedEntries, 2);
int tableSize = Integer.highestOneBit(expectedEntries);
// Check to make sure that we will not exceed the maximum load factor.
Reported by PMD.
guava/src/com/google/common/collect/TransformedIterator.java
1 issues
Line: 35
@ElementTypesAreNonnullByDefault
abstract class TransformedIterator<F extends @Nullable Object, T extends @Nullable Object>
implements Iterator<T> {
final Iterator<? extends F> backingIterator;
TransformedIterator(Iterator<? extends F> backingIterator) {
this.backingIterator = checkNotNull(backingIterator);
}
Reported by PMD.
guava-tests/test/com/google/common/io/TestReader.java
1 issues
Line: 30
/** @author Colin Decker */
public class TestReader extends FilterReader {
private final TestInputStream in;
public TestReader(TestOption... options) throws IOException {
this(new TestInputStream(new ByteArrayInputStream(new byte[10]), options));
}
Reported by PMD.
guava-tests/test/com/google/common/io/TestWriter.java
1 issues
Line: 29
/** @author Colin Decker */
public class TestWriter extends FilterWriter {
private final TestOutputStream out;
public TestWriter(TestOption... options) throws IOException {
this(new TestOutputStream(ByteStreams.nullOutputStream(), options));
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/CollectionSerializationTester.java
1 issues
Line: 36
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionSerializationTester<E> extends AbstractCollectionTester<E> {
@CollectionFeature.Require(SERIALIZABLE)
public void testReserialize() {
// For a bare Collection, the most we can guarantee is that the elements are preserved.
Helpers.assertEqualIgnoringOrder(
actualContents(), SerializableTester.reserialize(actualContents()));
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/CollectionSerializationEqualTester.java
1 issues
Line: 36
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionSerializationEqualTester<E> extends AbstractCollectionTester<E> {
@CollectionFeature.Require(SERIALIZABLE)
public void testReserialize() {
assertEquals(SerializableTester.reserialize(actualContents()), actualContents());
}
}
Reported by PMD.