The following issues were found
guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveEntryTester.java
57 issues
Line: 46
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAbsent() {
assertFalse(multimap().remove(k0(), v1()));
expectUnchanged();
}
Reported by PMD.
Line: 47
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAbsent() {
assertFalse(multimap().remove(k0(), v1()));
expectUnchanged();
}
Reported by PMD.
Line: 49
public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAbsent() {
assertFalse(multimap().remove(k0(), v1()));
expectUnchanged();
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 53
expectUnchanged();
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemovePresent() {
assertTrue(multimap().remove(k0(), v0()));
assertFalse(multimap().containsEntry(k0(), v0()));
Reported by PMD.
Line: 55
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemovePresent() {
assertTrue(multimap().remove(k0(), v0()));
assertFalse(multimap().containsEntry(k0(), v0()));
expectMissing(e0());
assertEquals(getNumElements() - 1, multimap().size());
Reported by PMD.
Line: 56
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemovePresent() {
assertTrue(multimap().remove(k0(), v0()));
assertFalse(multimap().containsEntry(k0(), v0()));
expectMissing(e0());
assertEquals(getNumElements() - 1, multimap().size());
assertGet(k0(), ImmutableList.<V>of());
Reported by PMD.
Line: 58
public void testRemovePresent() {
assertTrue(multimap().remove(k0(), v0()));
assertFalse(multimap().containsEntry(k0(), v0()));
expectMissing(e0());
assertEquals(getNumElements() - 1, multimap().size());
assertGet(k0(), ImmutableList.<V>of());
}
Reported by PMD.
Line: 60
assertFalse(multimap().containsEntry(k0(), v0()));
expectMissing(e0());
assertEquals(getNumElements() - 1, multimap().size());
assertGet(k0(), ImmutableList.<V>of());
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
Reported by PMD.
Line: 64
assertGet(k0(), ImmutableList.<V>of());
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
public void testRemoveNullKeyPresent() {
initMultimapWithNullKey();
assertTrue(multimap().remove(null, getValueForNullKey()));
Reported by PMD.
Line: 66
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
public void testRemoveNullKeyPresent() {
initMultimapWithNullKey();
assertTrue(multimap().remove(null, getValueForNullKey()));
expectMissing(Helpers.mapEntry((K) null, getValueForNullKey()));
Reported by PMD.
android/guava/src/com/google/common/math/BigIntegerMath.java
57 issues
Line: 475
*
* @throws IllegalArgumentException if {@code n < 0}, {@code k < 0}, or {@code k > n}
*/
public static BigInteger binomial(int n, int k) {
checkNonNegative("n", n);
checkNonNegative("k", k);
checkArgument(k <= n, "k (%s) > n (%s)", k, n);
if (k > (n >> 1)) {
k = n - k;
Reported by PMD.
Line: 52
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class BigIntegerMath {
/**
* Returns the smallest power of two greater than or equal to {@code x}. This is equivalent to
* {@code BigInteger.valueOf(2).pow(log2(x, CEILING))}.
*
* @throws IllegalArgumentException if {@code x <= 0}
Reported by PMD.
Line: 52
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class BigIntegerMath {
/**
* Returns the smallest power of two greater than or equal to {@code x}. This is equivalent to
* {@code BigInteger.valueOf(2).pow(log2(x, CEILING))}.
*
* @throws IllegalArgumentException if {@code x <= 0}
Reported by PMD.
Line: 52
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class BigIntegerMath {
/**
* Returns the smallest power of two greater than or equal to {@code x}. This is equivalent to
* {@code BigInteger.valueOf(2).pow(log2(x, CEILING))}.
*
* @throws IllegalArgumentException if {@code x <= 0}
Reported by PMD.
Line: 62
*/
@Beta
public static BigInteger ceilingPowerOfTwo(BigInteger x) {
return BigInteger.ZERO.setBit(log2(x, CEILING));
}
/**
* Returns the largest power of two less than or equal to {@code x}. This is equivalent to {@code
* BigInteger.valueOf(2).pow(log2(x, FLOOR))}.
Reported by PMD.
Line: 74
*/
@Beta
public static BigInteger floorPowerOfTwo(BigInteger x) {
return BigInteger.ZERO.setBit(log2(x, FLOOR));
}
/** Returns {@code true} if {@code x} represents a power of two. */
public static boolean isPowerOfTwo(BigInteger x) {
checkNotNull(x);
Reported by PMD.
Line: 92
*/
@SuppressWarnings("fallthrough")
// TODO(kevinb): remove after this warning is disabled globally
public static int log2(BigInteger x, RoundingMode mode) {
checkPositive("x", checkNotNull(x));
int logFloor = x.bitLength() - 1;
switch (mode) {
case UNNECESSARY:
checkRoundingUnnecessary(isPowerOfTwo(x)); // fall through
Reported by PMD.
Line: 123
// To determine which side of logFloor.5 the logarithm is,
// we compare x^2 to 2^(2 * logFloor + 1).
BigInteger x2 = x.pow(2);
int logX2Floor = x2.bitLength() - 1;
return (logX2Floor < 2 * logFloor + 1) ? logFloor : logFloor + 1;
default:
throw new AssertionError();
}
Reported by PMD.
Line: 151
*/
@GwtIncompatible // TODO
@SuppressWarnings("fallthrough")
public static int log10(BigInteger x, RoundingMode mode) {
checkPositive("x", x);
if (fitsInLong(x)) {
return LongMath.log10(x.longValue(), mode);
}
Reported by PMD.
Line: 151
*/
@GwtIncompatible // TODO
@SuppressWarnings("fallthrough")
public static int log10(BigInteger x, RoundingMode mode) {
checkPositive("x", x);
if (fitsInLong(x)) {
return LongMath.log10(x.longValue(), mode);
}
Reported by PMD.
android/guava-tests/test/com/google/common/io/MultiReaderTest.java
57 issues
Line: 29
/** @author ricebin */
public class MultiReaderTest extends TestCase {
public void testOnlyOneOpen() throws Exception {
String testString = "abcdefgh";
final CharSource source = newCharSource(testString);
final int[] counter = new int[1];
CharSource reader =
new CharSource() {
Reported by PMD.
Line: 37
new CharSource() {
@Override
public Reader openStream() throws IOException {
if (counter[0]++ != 0) {
throw new IllegalStateException("More than one source open");
}
return new FilterReader(source.openStream()) {
@Override
public void close() throws IOException {
Reported by PMD.
Line: 49
};
}
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
Reported by PMD.
Line: 49
};
}
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
Reported by PMD.
Line: 51
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reported by PMD.
Line: 51
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reported by PMD.
Line: 51
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reported by PMD.
Line: 54
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reader joinedReader = CharSource.concat(list).openStream();
assertTrue(joinedReader.ready());
Reported by PMD.
Line: 54
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reader joinedReader = CharSource.concat(list).openStream();
assertTrue(joinedReader.ready());
Reported by PMD.
Line: 57
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reader joinedReader = CharSource.concat(list).openStream();
assertTrue(joinedReader.ready());
assertEquals('a', joinedReader.read());
assertEquals('a', joinedReader.read());
assertEquals(-1, joinedReader.read());
Reported by PMD.
guava/src/com/google/common/collect/Lists.java
57 issues
Line: 984
for (Object o : list) {
hashCode = 31 * hashCode + (o == null ? 0 : o.hashCode());
hashCode = ~~hashCode;
// needed to deal with GWT integer overflow
}
return hashCode;
}
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkElementIndex;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkPositionIndex;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkElementIndex;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkPositionIndex;
Reported by PMD.
Line: 69
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Lists {
private Lists() {}
// ArrayList
/**
Reported by PMD.
Line: 69
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Lists {
private Lists() {}
// ArrayList
/**
Reported by PMD.
Line: 69
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Lists {
private Lists() {}
// ArrayList
/**
Reported by PMD.
Line: 84
* directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>.
*/
@GwtCompatible(serializable = true)
public static <E extends @Nullable Object> ArrayList<E> newArrayList() {
return new ArrayList<>();
}
/**
* Creates a <i>mutable</i> {@code ArrayList} instance containing the given elements.
Reported by PMD.
Line: 104
*/
@SafeVarargs
@GwtCompatible(serializable = true)
public static <E extends @Nullable Object> ArrayList<E> newArrayList(E... elements) {
checkNotNull(elements); // for GWT
// Avoid integer overflow when a large array is passed in
int capacity = computeArrayListCapacity(elements.length);
ArrayList<E> list = new ArrayList<>(capacity);
Collections.addAll(list, elements);
Reported by PMD.
Line: 127
* syntax</a>.
*/
@GwtCompatible(serializable = true)
public static <E extends @Nullable Object> ArrayList<E> newArrayList(
Iterable<? extends E> elements) {
checkNotNull(elements); // for GWT
// Let ArrayList's sizing logic work, if possible
return (elements instanceof Collection)
? new ArrayList<>((Collection<? extends E>) elements)
Reported by PMD.
Line: 144
* ImmutableList#copyOf(Iterator)} instead.
*/
@GwtCompatible(serializable = true)
public static <E extends @Nullable Object> ArrayList<E> newArrayList(
Iterator<? extends E> elements) {
ArrayList<E> list = newArrayList();
Iterators.addAll(list, elements);
return list;
}
Reported by PMD.
guava/src/com/google/common/math/BigIntegerMath.java
57 issues
Line: 475
*
* @throws IllegalArgumentException if {@code n < 0}, {@code k < 0}, or {@code k > n}
*/
public static BigInteger binomial(int n, int k) {
checkNonNegative("n", n);
checkNonNegative("k", k);
checkArgument(k <= n, "k (%s) > n (%s)", k, n);
if (k > (n >> 1)) {
k = n - k;
Reported by PMD.
Line: 52
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class BigIntegerMath {
/**
* Returns the smallest power of two greater than or equal to {@code x}. This is equivalent to
* {@code BigInteger.valueOf(2).pow(log2(x, CEILING))}.
*
* @throws IllegalArgumentException if {@code x <= 0}
Reported by PMD.
Line: 52
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class BigIntegerMath {
/**
* Returns the smallest power of two greater than or equal to {@code x}. This is equivalent to
* {@code BigInteger.valueOf(2).pow(log2(x, CEILING))}.
*
* @throws IllegalArgumentException if {@code x <= 0}
Reported by PMD.
Line: 52
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class BigIntegerMath {
/**
* Returns the smallest power of two greater than or equal to {@code x}. This is equivalent to
* {@code BigInteger.valueOf(2).pow(log2(x, CEILING))}.
*
* @throws IllegalArgumentException if {@code x <= 0}
Reported by PMD.
Line: 62
*/
@Beta
public static BigInteger ceilingPowerOfTwo(BigInteger x) {
return BigInteger.ZERO.setBit(log2(x, CEILING));
}
/**
* Returns the largest power of two less than or equal to {@code x}. This is equivalent to {@code
* BigInteger.valueOf(2).pow(log2(x, FLOOR))}.
Reported by PMD.
Line: 74
*/
@Beta
public static BigInteger floorPowerOfTwo(BigInteger x) {
return BigInteger.ZERO.setBit(log2(x, FLOOR));
}
/** Returns {@code true} if {@code x} represents a power of two. */
public static boolean isPowerOfTwo(BigInteger x) {
checkNotNull(x);
Reported by PMD.
Line: 92
*/
@SuppressWarnings("fallthrough")
// TODO(kevinb): remove after this warning is disabled globally
public static int log2(BigInteger x, RoundingMode mode) {
checkPositive("x", checkNotNull(x));
int logFloor = x.bitLength() - 1;
switch (mode) {
case UNNECESSARY:
checkRoundingUnnecessary(isPowerOfTwo(x)); // fall through
Reported by PMD.
Line: 123
// To determine which side of logFloor.5 the logarithm is,
// we compare x^2 to 2^(2 * logFloor + 1).
BigInteger x2 = x.pow(2);
int logX2Floor = x2.bitLength() - 1;
return (logX2Floor < 2 * logFloor + 1) ? logFloor : logFloor + 1;
default:
throw new AssertionError();
}
Reported by PMD.
Line: 151
*/
@GwtIncompatible // TODO
@SuppressWarnings("fallthrough")
public static int log10(BigInteger x, RoundingMode mode) {
checkPositive("x", x);
if (fitsInLong(x)) {
return LongMath.log10(x.longValue(), mode);
}
Reported by PMD.
Line: 151
*/
@GwtIncompatible // TODO
@SuppressWarnings("fallthrough")
public static int log10(BigInteger x, RoundingMode mode) {
checkPositive("x", x);
if (fitsInLong(x)) {
return LongMath.log10(x.longValue(), mode);
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveEntryTester.java
57 issues
Line: 46
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAbsent() {
assertFalse(multimap().remove(k0(), v1()));
expectUnchanged();
}
Reported by PMD.
Line: 47
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAbsent() {
assertFalse(multimap().remove(k0(), v1()));
expectUnchanged();
}
Reported by PMD.
Line: 49
public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAbsent() {
assertFalse(multimap().remove(k0(), v1()));
expectUnchanged();
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 53
expectUnchanged();
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemovePresent() {
assertTrue(multimap().remove(k0(), v0()));
assertFalse(multimap().containsEntry(k0(), v0()));
Reported by PMD.
Line: 55
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemovePresent() {
assertTrue(multimap().remove(k0(), v0()));
assertFalse(multimap().containsEntry(k0(), v0()));
expectMissing(e0());
assertEquals(getNumElements() - 1, multimap().size());
Reported by PMD.
Line: 56
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemovePresent() {
assertTrue(multimap().remove(k0(), v0()));
assertFalse(multimap().containsEntry(k0(), v0()));
expectMissing(e0());
assertEquals(getNumElements() - 1, multimap().size());
assertGet(k0(), ImmutableList.<V>of());
Reported by PMD.
Line: 58
public void testRemovePresent() {
assertTrue(multimap().remove(k0(), v0()));
assertFalse(multimap().containsEntry(k0(), v0()));
expectMissing(e0());
assertEquals(getNumElements() - 1, multimap().size());
assertGet(k0(), ImmutableList.<V>of());
}
Reported by PMD.
Line: 60
assertFalse(multimap().containsEntry(k0(), v0()));
expectMissing(e0());
assertEquals(getNumElements() - 1, multimap().size());
assertGet(k0(), ImmutableList.<V>of());
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
Reported by PMD.
Line: 64
assertGet(k0(), ImmutableList.<V>of());
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
public void testRemoveNullKeyPresent() {
initMultimapWithNullKey();
assertTrue(multimap().remove(null, getValueForNullKey()));
Reported by PMD.
Line: 66
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
public void testRemoveNullKeyPresent() {
initMultimapWithNullKey();
assertTrue(multimap().remove(null, getValueForNullKey()));
expectMissing(Helpers.mapEntry((K) null, getValueForNullKey()));
Reported by PMD.
guava-tests/test/com/google/common/io/MultiReaderTest.java
57 issues
Line: 29
/** @author ricebin */
public class MultiReaderTest extends TestCase {
public void testOnlyOneOpen() throws Exception {
String testString = "abcdefgh";
final CharSource source = newCharSource(testString);
final int[] counter = new int[1];
CharSource reader =
new CharSource() {
Reported by PMD.
Line: 37
new CharSource() {
@Override
public Reader openStream() throws IOException {
if (counter[0]++ != 0) {
throw new IllegalStateException("More than one source open");
}
return new FilterReader(source.openStream()) {
@Override
public void close() throws IOException {
Reported by PMD.
Line: 49
};
}
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
Reported by PMD.
Line: 49
};
}
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
Reported by PMD.
Line: 51
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reported by PMD.
Line: 51
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reported by PMD.
Line: 51
};
Reader joinedReader = CharSource.concat(reader, reader, reader).openStream();
String result = CharStreams.toString(joinedReader);
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reported by PMD.
Line: 54
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reader joinedReader = CharSource.concat(list).openStream();
assertTrue(joinedReader.ready());
Reported by PMD.
Line: 54
assertEquals(testString.length() * 3, result.length());
}
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reader joinedReader = CharSource.concat(list).openStream();
assertTrue(joinedReader.ready());
Reported by PMD.
Line: 57
public void testReady() throws Exception {
CharSource source = newCharSource("a");
Iterable<? extends CharSource> list = ImmutableList.of(source, source);
Reader joinedReader = CharSource.concat(list).openStream();
assertTrue(joinedReader.ready());
assertEquals('a', joinedReader.read());
assertEquals('a', joinedReader.read());
assertEquals(-1, joinedReader.read());
Reported by PMD.
android/guava-tests/test/com/google/common/hash/FunnelsTest.java
57 issues
Line: 38
*
* @author Dimitris Andreou
*/
public class FunnelsTest extends TestCase {
public void testForBytes() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.byteArrayFunnel().funnel(new byte[] {4, 3, 2, 1}, primitiveSink);
verify(primitiveSink).putBytes(new byte[] {4, 3, 2, 1});
}
Reported by PMD.
Line: 39
* @author Dimitris Andreou
*/
public class FunnelsTest extends TestCase {
public void testForBytes() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.byteArrayFunnel().funnel(new byte[] {4, 3, 2, 1}, primitiveSink);
verify(primitiveSink).putBytes(new byte[] {4, 3, 2, 1});
}
Reported by PMD.
Line: 45
verify(primitiveSink).putBytes(new byte[] {4, 3, 2, 1});
}
public void testForBytes_null() {
assertNullsThrowException(Funnels.byteArrayFunnel());
}
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Reported by PMD.
Line: 49
assertNullsThrowException(Funnels.byteArrayFunnel());
}
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.unencodedCharsFunnel().funnel("test", primitiveSink);
verify(primitiveSink).putUnencodedChars("test");
}
Reported by PMD.
Line: 51
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.unencodedCharsFunnel().funnel("test", primitiveSink);
verify(primitiveSink).putUnencodedChars("test");
}
public void testForStrings_null() {
assertNullsThrowException(Funnels.unencodedCharsFunnel());
Reported by PMD.
Line: 51
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.unencodedCharsFunnel().funnel("test", primitiveSink);
verify(primitiveSink).putUnencodedChars("test");
}
public void testForStrings_null() {
assertNullsThrowException(Funnels.unencodedCharsFunnel());
Reported by PMD.
Line: 52
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.unencodedCharsFunnel().funnel("test", primitiveSink);
verify(primitiveSink).putUnencodedChars("test");
}
public void testForStrings_null() {
assertNullsThrowException(Funnels.unencodedCharsFunnel());
}
Reported by PMD.
Line: 55
verify(primitiveSink).putUnencodedChars("test");
}
public void testForStrings_null() {
assertNullsThrowException(Funnels.unencodedCharsFunnel());
}
public void testForStringsCharset() {
for (Charset charset : Charset.availableCharsets().values()) {
Reported by PMD.
Line: 59
assertNullsThrowException(Funnels.unencodedCharsFunnel());
}
public void testForStringsCharset() {
for (Charset charset : Charset.availableCharsets().values()) {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.stringFunnel(charset).funnel("test", primitiveSink);
verify(primitiveSink).putString("test", charset);
}
Reported by PMD.
Line: 60
}
public void testForStringsCharset() {
for (Charset charset : Charset.availableCharsets().values()) {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.stringFunnel(charset).funnel("test", primitiveSink);
verify(primitiveSink).putString("test", charset);
}
}
Reported by PMD.
guava-tests/test/com/google/common/hash/FunnelsTest.java
57 issues
Line: 38
*
* @author Dimitris Andreou
*/
public class FunnelsTest extends TestCase {
public void testForBytes() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.byteArrayFunnel().funnel(new byte[] {4, 3, 2, 1}, primitiveSink);
verify(primitiveSink).putBytes(new byte[] {4, 3, 2, 1});
}
Reported by PMD.
Line: 39
* @author Dimitris Andreou
*/
public class FunnelsTest extends TestCase {
public void testForBytes() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.byteArrayFunnel().funnel(new byte[] {4, 3, 2, 1}, primitiveSink);
verify(primitiveSink).putBytes(new byte[] {4, 3, 2, 1});
}
Reported by PMD.
Line: 45
verify(primitiveSink).putBytes(new byte[] {4, 3, 2, 1});
}
public void testForBytes_null() {
assertNullsThrowException(Funnels.byteArrayFunnel());
}
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Reported by PMD.
Line: 49
assertNullsThrowException(Funnels.byteArrayFunnel());
}
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.unencodedCharsFunnel().funnel("test", primitiveSink);
verify(primitiveSink).putUnencodedChars("test");
}
Reported by PMD.
Line: 51
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.unencodedCharsFunnel().funnel("test", primitiveSink);
verify(primitiveSink).putUnencodedChars("test");
}
public void testForStrings_null() {
assertNullsThrowException(Funnels.unencodedCharsFunnel());
Reported by PMD.
Line: 51
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.unencodedCharsFunnel().funnel("test", primitiveSink);
verify(primitiveSink).putUnencodedChars("test");
}
public void testForStrings_null() {
assertNullsThrowException(Funnels.unencodedCharsFunnel());
Reported by PMD.
Line: 52
public void testForStrings() {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.unencodedCharsFunnel().funnel("test", primitiveSink);
verify(primitiveSink).putUnencodedChars("test");
}
public void testForStrings_null() {
assertNullsThrowException(Funnels.unencodedCharsFunnel());
}
Reported by PMD.
Line: 55
verify(primitiveSink).putUnencodedChars("test");
}
public void testForStrings_null() {
assertNullsThrowException(Funnels.unencodedCharsFunnel());
}
public void testForStringsCharset() {
for (Charset charset : Charset.availableCharsets().values()) {
Reported by PMD.
Line: 59
assertNullsThrowException(Funnels.unencodedCharsFunnel());
}
public void testForStringsCharset() {
for (Charset charset : Charset.availableCharsets().values()) {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.stringFunnel(charset).funnel("test", primitiveSink);
verify(primitiveSink).putString("test", charset);
}
Reported by PMD.
Line: 60
}
public void testForStringsCharset() {
for (Charset charset : Charset.availableCharsets().values()) {
PrimitiveSink primitiveSink = mock(PrimitiveSink.class);
Funnels.stringFunnel(charset).funnel("test", primitiveSink);
verify(primitiveSink).putString("test", charset);
}
}
Reported by PMD.
android/guava/src/com/google/common/collect/Lists.java
57 issues
Line: 970
for (Object o : list) {
hashCode = 31 * hashCode + (o == null ? 0 : o.hashCode());
hashCode = ~~hashCode;
// needed to deal with GWT integer overflow
}
return hashCode;
}
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkElementIndex;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkPositionIndex;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkElementIndex;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkPositionIndex;
Reported by PMD.
Line: 68
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Lists {
private Lists() {}
// ArrayList
/**
Reported by PMD.
Line: 68
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Lists {
private Lists() {}
// ArrayList
/**
Reported by PMD.
Line: 68
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Lists {
private Lists() {}
// ArrayList
/**
Reported by PMD.
Line: 83
* directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>.
*/
@GwtCompatible(serializable = true)
public static <E extends @Nullable Object> ArrayList<E> newArrayList() {
return new ArrayList<>();
}
/**
* Creates a <i>mutable</i> {@code ArrayList} instance containing the given elements.
Reported by PMD.
Line: 103
*/
@SafeVarargs
@GwtCompatible(serializable = true)
public static <E extends @Nullable Object> ArrayList<E> newArrayList(E... elements) {
checkNotNull(elements); // for GWT
// Avoid integer overflow when a large array is passed in
int capacity = computeArrayListCapacity(elements.length);
ArrayList<E> list = new ArrayList<>(capacity);
Collections.addAll(list, elements);
Reported by PMD.
Line: 126
* syntax</a>.
*/
@GwtCompatible(serializable = true)
public static <E extends @Nullable Object> ArrayList<E> newArrayList(
Iterable<? extends E> elements) {
checkNotNull(elements); // for GWT
// Let ArrayList's sizing logic work, if possible
return (elements instanceof Collection)
? new ArrayList<>((Collection<? extends E>) elements)
Reported by PMD.
Line: 143
* ImmutableList#copyOf(Iterator)} instead.
*/
@GwtCompatible(serializable = true)
public static <E extends @Nullable Object> ArrayList<E> newArrayList(
Iterator<? extends E> elements) {
ArrayList<E> list = newArrayList();
Iterators.addAll(list, elements);
return list;
}
Reported by PMD.