The following issues were found
android/guava-tests/test/com/google/common/primitives/BytesTest.java
150 issues
Line: 250
testReverse(new byte[] {-1, 1, -2, 2}, new byte[] {2, -2, 1, -1});
}
private static void testReverse(byte[] input, byte[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Bytes.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 256
assertTrue(Arrays.equals(expectedOutput, input));
}
private static void testReverse(byte[] input, int fromIndex, int toIndex, byte[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Bytes.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 35
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class BytesTest extends TestCase {
private static final byte[] EMPTY = {};
private static final byte[] ARRAY1 = {(byte) 1};
private static final byte[] ARRAY234 = {(byte) 2, (byte) 3, (byte) 4};
private static final byte[] VALUES = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
Reported by PMD.
Line: 42
private static final byte[] VALUES = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
public void testHashCode() {
for (byte value : VALUES) {
assertEquals(((Byte) value).hashCode(), Bytes.hashCode(value));
}
}
Reported by PMD.
Line: 44
public void testHashCode() {
for (byte value : VALUES) {
assertEquals(((Byte) value).hashCode(), Bytes.hashCode(value));
}
}
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
Reported by PMD.
Line: 48
}
}
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
Reported by PMD.
Line: 48
}
}
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
Reported by PMD.
Line: 49
}
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
assertTrue(Bytes.contains(ARRAY234, (byte) 3));
Reported by PMD.
Line: 50
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
assertTrue(Bytes.contains(ARRAY234, (byte) 3));
assertTrue(Bytes.contains(ARRAY234, (byte) 4));
Reported by PMD.
Line: 51
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
assertTrue(Bytes.contains(ARRAY234, (byte) 3));
assertTrue(Bytes.contains(ARRAY234, (byte) 4));
}
Reported by PMD.
android/guava-tests/test/com/google/common/base/OptionalTest.java
149 issues
Line: 213
public void testEqualsAndHashCode() {
new EqualsTester()
.addEqualityGroup(Optional.absent(), reserialize(Optional.absent()))
.addEqualityGroup(Optional.of(new Long(5)), reserialize(Optional.of(new Long(5))))
.addEqualityGroup(Optional.of(new Long(42)), reserialize(Optional.of(new Long(42))))
.testEquals();
}
public void testToString_absent() {
Reported by PMD.
Line: 213
public void testEqualsAndHashCode() {
new EqualsTester()
.addEqualityGroup(Optional.absent(), reserialize(Optional.absent()))
.addEqualityGroup(Optional.of(new Long(5)), reserialize(Optional.of(new Long(5))))
.addEqualityGroup(Optional.of(new Long(42)), reserialize(Optional.of(new Long(42))))
.testEquals();
}
public void testToString_absent() {
Reported by PMD.
Line: 214
new EqualsTester()
.addEqualityGroup(Optional.absent(), reserialize(Optional.absent()))
.addEqualityGroup(Optional.of(new Long(5)), reserialize(Optional.of(new Long(5))))
.addEqualityGroup(Optional.of(new Long(42)), reserialize(Optional.of(new Long(42))))
.testEquals();
}
public void testToString_absent() {
assertEquals("Optional.absent()", Optional.absent().toString());
Reported by PMD.
Line: 214
new EqualsTester()
.addEqualityGroup(Optional.absent(), reserialize(Optional.absent()))
.addEqualityGroup(Optional.of(new Long(5)), reserialize(Optional.of(new Long(5))))
.addEqualityGroup(Optional.of(new Long(42)), reserialize(Optional.of(new Long(42))))
.testEquals();
}
public void testToString_absent() {
assertEquals("Optional.absent()", Optional.absent().toString());
Reported by PMD.
Line: 39
* @author Kurt Alfred Kluever
*/
@GwtCompatible(emulated = true)
public final class OptionalTest extends TestCase {
public void testAbsent() {
Optional<String> optionalName = Optional.absent();
assertFalse(optionalName.isPresent());
}
Reported by PMD.
Line: 40
*/
@GwtCompatible(emulated = true)
public final class OptionalTest extends TestCase {
public void testAbsent() {
Optional<String> optionalName = Optional.absent();
assertFalse(optionalName.isPresent());
}
public void testOf() {
Reported by PMD.
Line: 42
public final class OptionalTest extends TestCase {
public void testAbsent() {
Optional<String> optionalName = Optional.absent();
assertFalse(optionalName.isPresent());
}
public void testOf() {
assertEquals("training", Optional.of("training").get());
}
Reported by PMD.
Line: 42
public final class OptionalTest extends TestCase {
public void testAbsent() {
Optional<String> optionalName = Optional.absent();
assertFalse(optionalName.isPresent());
}
public void testOf() {
assertEquals("training", Optional.of("training").get());
}
Reported by PMD.
Line: 45
assertFalse(optionalName.isPresent());
}
public void testOf() {
assertEquals("training", Optional.of("training").get());
}
public void testOf_null() {
try {
Reported by PMD.
Line: 46
}
public void testOf() {
assertEquals("training", Optional.of("training").get());
}
public void testOf_null() {
try {
Optional.of(null);
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java
148 issues
Line: 152
try {
exitRun.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
@Override
protected void shutDown() {
Reported by PMD.
Line: 295
try {
enterRun.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
@Override
protected void shutDown() {
Reported by PMD.
Line: 39
*
* @author Jesse Wilson
*/
public class AbstractExecutionThreadServiceTest extends TestCase {
private final TearDownStack tearDownStack = new TearDownStack(true);
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
Reported by PMD.
Line: 41
*/
public class AbstractExecutionThreadServiceTest extends TestCase {
private final TearDownStack tearDownStack = new TearDownStack(true);
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
Reported by PMD.
Line: 42
public class AbstractExecutionThreadServiceTest extends TestCase {
private final TearDownStack tearDownStack = new TearDownStack(true);
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
Reported by PMD.
Line: 43
private final TearDownStack tearDownStack = new TearDownStack(true);
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
new Executor() {
Reported by PMD.
Line: 45
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
new Executor() {
@Override
public void execute(Runnable command) {
Reported by PMD.
Line: 46
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
new Executor() {
@Override
public void execute(Runnable command) {
executionThread = new Thread(command);
Reported by PMD.
Line: 47
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
new Executor() {
@Override
public void execute(Runnable command) {
executionThread = new Thread(command);
executionThread.setUncaughtExceptionHandler(
Reported by PMD.
Line: 63
}
};
@Override
protected final void tearDown() {
tearDownStack.runTearDown();
assertNull(
"exceptions should not be propagated to uncaught exception handlers",
thrownByExecutionThread);
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java
148 issues
Line: 152
try {
exitRun.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
@Override
protected void shutDown() {
Reported by PMD.
Line: 295
try {
enterRun.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
@Override
protected void shutDown() {
Reported by PMD.
Line: 39
*
* @author Jesse Wilson
*/
public class AbstractExecutionThreadServiceTest extends TestCase {
private final TearDownStack tearDownStack = new TearDownStack(true);
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
Reported by PMD.
Line: 41
*/
public class AbstractExecutionThreadServiceTest extends TestCase {
private final TearDownStack tearDownStack = new TearDownStack(true);
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
Reported by PMD.
Line: 42
public class AbstractExecutionThreadServiceTest extends TestCase {
private final TearDownStack tearDownStack = new TearDownStack(true);
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
Reported by PMD.
Line: 43
private final TearDownStack tearDownStack = new TearDownStack(true);
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
new Executor() {
Reported by PMD.
Line: 45
private final CountDownLatch enterRun = new CountDownLatch(1);
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
new Executor() {
@Override
public void execute(Runnable command) {
Reported by PMD.
Line: 46
private final CountDownLatch exitRun = new CountDownLatch(1);
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
new Executor() {
@Override
public void execute(Runnable command) {
executionThread = new Thread(command);
Reported by PMD.
Line: 47
private Thread executionThread;
private Throwable thrownByExecutionThread;
private final Executor exceptionCatchingExecutor =
new Executor() {
@Override
public void execute(Runnable command) {
executionThread = new Thread(command);
executionThread.setUncaughtExceptionHandler(
Reported by PMD.
Line: 63
}
};
@Override
protected final void tearDown() {
tearDownStack.runTearDown();
assertNull(
"exceptions should not be propagated to uncaught exception handlers",
thrownByExecutionThread);
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java
147 issues
Line: 32
*
* @author Sven Mawson
*/
public class SettableFutureTest extends TestCase {
private SettableFuture<String> future;
private ListenableFutureTester tester;
@Override
Reported by PMD.
Line: 34
*/
public class SettableFutureTest extends TestCase {
private SettableFuture<String> future;
private ListenableFutureTester tester;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 35
public class SettableFutureTest extends TestCase {
private SettableFuture<String> future;
private ListenableFutureTester tester;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 37
private SettableFuture<String> future;
private ListenableFutureTester tester;
@Override
protected void setUp() throws Exception {
super.setUp();
future = SettableFuture.create();
tester = new ListenableFutureTester(future);
Reported by PMD.
Line: 46
tester.setUp();
}
public void testDefaultState() throws Exception {
try {
future.get(5, TimeUnit.MILLISECONDS);
fail();
} catch (TimeoutException expected) {
}
Reported by PMD.
Line: 49
public void testDefaultState() throws Exception {
try {
future.get(5, TimeUnit.MILLISECONDS);
fail();
} catch (TimeoutException expected) {
}
}
Reported by PMD.
Line: 49
public void testDefaultState() throws Exception {
try {
future.get(5, TimeUnit.MILLISECONDS);
fail();
} catch (TimeoutException expected) {
}
}
Reported by PMD.
Line: 55
}
public void testSetValue() throws Exception {
assertTrue(future.set("value"));
tester.testCompletedFuture("value");
}
Reported by PMD.
Line: 56
public void testSetValue() throws Exception {
assertTrue(future.set("value"));
tester.testCompletedFuture("value");
}
public void testSetFailure() throws Exception {
Reported by PMD.
Line: 61
}
public void testSetFailure() throws Exception {
assertTrue(future.setException(new Exception("failure")));
tester.testFailedFuture("failure");
}
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java
147 issues
Line: 32
*
* @author Sven Mawson
*/
public class SettableFutureTest extends TestCase {
private SettableFuture<String> future;
private ListenableFutureTester tester;
@Override
Reported by PMD.
Line: 34
*/
public class SettableFutureTest extends TestCase {
private SettableFuture<String> future;
private ListenableFutureTester tester;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 35
public class SettableFutureTest extends TestCase {
private SettableFuture<String> future;
private ListenableFutureTester tester;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 37
private SettableFuture<String> future;
private ListenableFutureTester tester;
@Override
protected void setUp() throws Exception {
super.setUp();
future = SettableFuture.create();
tester = new ListenableFutureTester(future);
Reported by PMD.
Line: 46
tester.setUp();
}
public void testDefaultState() throws Exception {
try {
future.get(5, TimeUnit.MILLISECONDS);
fail();
} catch (TimeoutException expected) {
}
Reported by PMD.
Line: 49
public void testDefaultState() throws Exception {
try {
future.get(5, TimeUnit.MILLISECONDS);
fail();
} catch (TimeoutException expected) {
}
}
Reported by PMD.
Line: 49
public void testDefaultState() throws Exception {
try {
future.get(5, TimeUnit.MILLISECONDS);
fail();
} catch (TimeoutException expected) {
}
}
Reported by PMD.
Line: 55
}
public void testSetValue() throws Exception {
assertTrue(future.set("value"));
tester.testCompletedFuture("value");
}
Reported by PMD.
Line: 56
public void testSetValue() throws Exception {
assertTrue(future.set("value"));
tester.testCompletedFuture("value");
}
public void testSetFailure() throws Exception {
Reported by PMD.
Line: 61
}
public void testSetFailure() throws Exception {
assertTrue(future.setException(new Exception("failure")));
tester.testFailedFuture("failure");
}
Reported by PMD.
guava-tests/test/com/google/common/base/JoinerTest.java
147 issues
Line: 338
private final Iterator<Integer> iterator;
public IterableIterator() {
this.iterator = iterator();
}
@Override
public Iterator<Integer> iterator() {
return INTEGERS.iterator();
Reported by PMD.
Line: 43
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class JoinerTest extends TestCase {
private static final Joiner J = Joiner.on("-");
// <Integer> needed to prevent warning :(
private static final Iterable<Integer> ITERABLE_ = Arrays.<Integer>asList();
private static final Iterable<Integer> ITERABLE_1 = Arrays.asList(1);
Reported by PMD.
Line: 59
private static final Iterable<Integer> ITERABLE_FOUR_NULLS =
Arrays.asList((Integer) null, null, null, null);
public void testNoSpecialNullBehavior() {
checkNoOutput(J, ITERABLE_);
checkResult(J, ITERABLE_1, "1");
checkResult(J, ITERABLE_12, "1-2");
checkResult(J, ITERABLE_123, "1-2-3");
Reported by PMD.
Line: 62
public void testNoSpecialNullBehavior() {
checkNoOutput(J, ITERABLE_);
checkResult(J, ITERABLE_1, "1");
checkResult(J, ITERABLE_12, "1-2");
checkResult(J, ITERABLE_123, "1-2-3");
try {
J.join(ITERABLE_NULL);
fail();
Reported by PMD.
Line: 63
checkNoOutput(J, ITERABLE_);
checkResult(J, ITERABLE_1, "1");
checkResult(J, ITERABLE_12, "1-2");
checkResult(J, ITERABLE_123, "1-2-3");
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
Reported by PMD.
Line: 67
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
Reported by PMD.
Line: 67
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
Reported by PMD.
Line: 68
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
} catch (NullPointerException expected) {
Reported by PMD.
Line: 68
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
} catch (NullPointerException expected) {
Reported by PMD.
Line: 72
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_NULL.iterator());
Reported by PMD.
android/guava-tests/test/com/google/common/base/JoinerTest.java
147 issues
Line: 338
private final Iterator<Integer> iterator;
public IterableIterator() {
this.iterator = iterator();
}
@Override
public Iterator<Integer> iterator() {
return INTEGERS.iterator();
Reported by PMD.
Line: 43
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class JoinerTest extends TestCase {
private static final Joiner J = Joiner.on("-");
// <Integer> needed to prevent warning :(
private static final Iterable<Integer> ITERABLE_ = Arrays.<Integer>asList();
private static final Iterable<Integer> ITERABLE_1 = Arrays.asList(1);
Reported by PMD.
Line: 59
private static final Iterable<Integer> ITERABLE_FOUR_NULLS =
Arrays.asList((Integer) null, null, null, null);
public void testNoSpecialNullBehavior() {
checkNoOutput(J, ITERABLE_);
checkResult(J, ITERABLE_1, "1");
checkResult(J, ITERABLE_12, "1-2");
checkResult(J, ITERABLE_123, "1-2-3");
Reported by PMD.
Line: 62
public void testNoSpecialNullBehavior() {
checkNoOutput(J, ITERABLE_);
checkResult(J, ITERABLE_1, "1");
checkResult(J, ITERABLE_12, "1-2");
checkResult(J, ITERABLE_123, "1-2-3");
try {
J.join(ITERABLE_NULL);
fail();
Reported by PMD.
Line: 63
checkNoOutput(J, ITERABLE_);
checkResult(J, ITERABLE_1, "1");
checkResult(J, ITERABLE_12, "1-2");
checkResult(J, ITERABLE_123, "1-2-3");
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
Reported by PMD.
Line: 67
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
Reported by PMD.
Line: 67
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
Reported by PMD.
Line: 68
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
} catch (NullPointerException expected) {
Reported by PMD.
Line: 68
try {
J.join(ITERABLE_NULL);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
} catch (NullPointerException expected) {
Reported by PMD.
Line: 72
}
try {
J.join(ITERABLE_1_NULL_2);
fail();
} catch (NullPointerException expected) {
}
try {
J.join(ITERABLE_NULL.iterator());
Reported by PMD.
guava/src/com/google/common/collect/AbstractMapBasedMultimap.java
145 issues
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.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT;
Reported by PMD.
Line: 90
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @Nullable Object>
extends AbstractMultimap<K, V> implements Serializable {
/*
* Here's an outline of the overall design.
*
* The map variable contains the collection of values associated with each
Reported by PMD.
Line: 90
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @Nullable Object>
extends AbstractMultimap<K, V> implements Serializable {
/*
* Here's an outline of the overall design.
*
* The map variable contains the collection of values associated with each
Reported by PMD.
Line: 91
@GwtCompatible
@ElementTypesAreNonnullByDefault
abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @Nullable Object>
extends AbstractMultimap<K, V> implements Serializable {
/*
* Here's an outline of the overall design.
*
* The map variable contains the collection of values associated with each
* key. When a key-value pair is added to a multimap that didn't previously
Reported by PMD.
Line: 198
} else {
throw new AssertionError("New Collection violated the Collection spec");
}
} else if (collection.add(value)) {
totalSize++;
return true;
} else {
return false;
}
Reported by PMD.
Line: 232
// TODO(lowasser): investigate atomic failure?
Collection<V> collection = getOrCreateCollection(key);
Collection<V> oldValues = createCollection();
oldValues.addAll(collection);
totalSize -= collection.size();
collection.clear();
while (iterator.hasNext()) {
Reported by PMD.
Line: 234
Collection<V> oldValues = createCollection();
oldValues.addAll(collection);
totalSize -= collection.size();
collection.clear();
while (iterator.hasNext()) {
if (collection.add(iterator.next())) {
totalSize++;
Reported by PMD.
Line: 235
oldValues.addAll(collection);
totalSize -= collection.size();
collection.clear();
while (iterator.hasNext()) {
if (collection.add(iterator.next())) {
totalSize++;
}
Reported by PMD.
Line: 260
}
Collection<V> output = createCollection();
output.addAll(collection);
totalSize -= collection.size();
collection.clear();
return unmodifiableCollectionSubclass(output);
}
Reported by PMD.
Line: 261
Collection<V> output = createCollection();
output.addAll(collection);
totalSize -= collection.size();
collection.clear();
return unmodifiableCollectionSubclass(output);
}
Reported by PMD.
guava-tests/test/com/google/common/reflect/TypesTest.java
144 issues
Line: 46
* @author Ben Yu
*/
@AndroidIncompatible // lots of failures, possibly some related to bad equals() implementations?
public class TypesTest extends TestCase {
public void testNewParameterizedType_ownerTypeImplied() throws Exception {
ParameterizedType jvmType =
(ParameterizedType) new TypeCapture<Entry<String, Integer>>() {}.capture();
ParameterizedType ourType =
Types.newParameterizedType(Entry.class, String.class, Integer.class);
Reported by PMD.
Line: 47
*/
@AndroidIncompatible // lots of failures, possibly some related to bad equals() implementations?
public class TypesTest extends TestCase {
public void testNewParameterizedType_ownerTypeImplied() throws Exception {
ParameterizedType jvmType =
(ParameterizedType) new TypeCapture<Entry<String, Integer>>() {}.capture();
ParameterizedType ourType =
Types.newParameterizedType(Entry.class, String.class, Integer.class);
assertEquals(jvmType, ourType);
Reported by PMD.
Line: 47
*/
@AndroidIncompatible // lots of failures, possibly some related to bad equals() implementations?
public class TypesTest extends TestCase {
public void testNewParameterizedType_ownerTypeImplied() throws Exception {
ParameterizedType jvmType =
(ParameterizedType) new TypeCapture<Entry<String, Integer>>() {}.capture();
ParameterizedType ourType =
Types.newParameterizedType(Entry.class, String.class, Integer.class);
assertEquals(jvmType, ourType);
Reported by PMD.
Line: 52
(ParameterizedType) new TypeCapture<Entry<String, Integer>>() {}.capture();
ParameterizedType ourType =
Types.newParameterizedType(Entry.class, String.class, Integer.class);
assertEquals(jvmType, ourType);
assertEquals(Map.class, ourType.getOwnerType());
}
public void testNewParameterizedType() {
ParameterizedType jvmType =
Reported by PMD.
Line: 53
ParameterizedType ourType =
Types.newParameterizedType(Entry.class, String.class, Integer.class);
assertEquals(jvmType, ourType);
assertEquals(Map.class, ourType.getOwnerType());
}
public void testNewParameterizedType() {
ParameterizedType jvmType =
(ParameterizedType) new TypeCapture<HashMap<String, int[][]>>() {}.capture();
Reported by PMD.
Line: 53
ParameterizedType ourType =
Types.newParameterizedType(Entry.class, String.class, Integer.class);
assertEquals(jvmType, ourType);
assertEquals(Map.class, ourType.getOwnerType());
}
public void testNewParameterizedType() {
ParameterizedType jvmType =
(ParameterizedType) new TypeCapture<HashMap<String, int[][]>>() {}.capture();
Reported by PMD.
Line: 56
assertEquals(Map.class, ourType.getOwnerType());
}
public void testNewParameterizedType() {
ParameterizedType jvmType =
(ParameterizedType) new TypeCapture<HashMap<String, int[][]>>() {}.capture();
ParameterizedType ourType =
Types.newParameterizedType(HashMap.class, String.class, int[][].class);
Reported by PMD.
Line: 56
assertEquals(Map.class, ourType.getOwnerType());
}
public void testNewParameterizedType() {
ParameterizedType jvmType =
(ParameterizedType) new TypeCapture<HashMap<String, int[][]>>() {}.capture();
ParameterizedType ourType =
Types.newParameterizedType(HashMap.class, String.class, int[][].class);
Reported by PMD.
Line: 60
ParameterizedType jvmType =
(ParameterizedType) new TypeCapture<HashMap<String, int[][]>>() {}.capture();
ParameterizedType ourType =
Types.newParameterizedType(HashMap.class, String.class, int[][].class);
new EqualsTester().addEqualityGroup(jvmType, ourType).testEquals();
assertEquals(jvmType.toString(), ourType.toString());
assertEquals(jvmType.hashCode(), ourType.hashCode());
assertEquals(HashMap.class, ourType.getRawType());
Reported by PMD.
Line: 63
Types.newParameterizedType(HashMap.class, String.class, int[][].class);
new EqualsTester().addEqualityGroup(jvmType, ourType).testEquals();
assertEquals(jvmType.toString(), ourType.toString());
assertEquals(jvmType.hashCode(), ourType.hashCode());
assertEquals(HashMap.class, ourType.getRawType());
assertThat(ourType.getActualTypeArguments())
.asList()
.containsExactlyElementsIn(asList(jvmType.getActualTypeArguments()))
Reported by PMD.