The following issues were found
android/guava/src/com/google/common/collect/StandardTable.java
122 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.alwaysTrue;
import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Predicates.in;
Reported by PMD.
Line: 68
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
@GwtTransient final Map<R, Map<C, V>> backingMap;
@GwtTransient final Supplier<? extends Map<C, V>> factory;
StandardTable(Map<R, Map<C, V>> backingMap, Supplier<? extends Map<C, V>> factory) {
this.backingMap = backingMap;
Reported by PMD.
Line: 69
@GwtCompatible
@ElementTypesAreNonnullByDefault
class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
@GwtTransient final Map<R, Map<C, V>> backingMap;
@GwtTransient final Supplier<? extends Map<C, V>> factory;
StandardTable(Map<R, Map<C, V>> backingMap, Supplier<? extends Map<C, V>> factory) {
this.backingMap = backingMap;
this.factory = factory;
Reported by PMD.
Line: 70
@ElementTypesAreNonnullByDefault
class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
@GwtTransient final Map<R, Map<C, V>> backingMap;
@GwtTransient final Supplier<? extends Map<C, V>> factory;
StandardTable(Map<R, Map<C, V>> backingMap, Supplier<? extends Map<C, V>> factory) {
this.backingMap = backingMap;
this.factory = factory;
}
Reported by PMD.
Line: 150
checkNotNull(rowKey);
checkNotNull(columnKey);
checkNotNull(value);
return getOrCreate(rowKey).put(columnKey, value);
}
@CanIgnoreReturnValue
@Override
@CheckForNull
Reported by PMD.
Line: 164
if (map == null) {
return null;
}
V value = map.remove(columnKey);
if (map.isEmpty()) {
backingMap.remove(rowKey);
}
return value;
}
Reported by PMD.
Line: 165
return null;
}
V value = map.remove(columnKey);
if (map.isEmpty()) {
backingMap.remove(rowKey);
}
return value;
}
Reported by PMD.
Line: 174
@CanIgnoreReturnValue
private Map<R, V> removeColumn(@CheckForNull Object column) {
Map<R, V> output = new LinkedHashMap<>();
Iterator<Entry<R, Map<C, V>>> iterator = backingMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<R, Map<C, V>> entry = iterator.next();
V value = entry.getValue().remove(column);
if (value != null) {
output.put(entry.getKey(), value);
Reported by PMD.
Line: 177
Iterator<Entry<R, Map<C, V>>> iterator = backingMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<R, Map<C, V>> entry = iterator.next();
V value = entry.getValue().remove(column);
if (value != null) {
output.put(entry.getKey(), value);
if (entry.getValue().isEmpty()) {
iterator.remove();
}
Reported by PMD.
Line: 177
Iterator<Entry<R, Map<C, V>>> iterator = backingMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<R, Map<C, V>> entry = iterator.next();
V value = entry.getValue().remove(column);
if (value != null) {
output.put(entry.getKey(), value);
if (entry.getValue().isEmpty()) {
iterator.remove();
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java
122 issues
Line: 37
* @author Jared Levy
*/
@GwtCompatible
public class MapsTransformValuesUnmodifiableIteratorTest extends MapInterfaceTest<String, String> {
// TODO(jlevy): Move shared code of this class and MapsTransformValuesTest
// to a superclass.
public MapsTransformValuesUnmodifiableIteratorTest() {
super(true, true, false /*supportsPut*/, true, true, false);
Reported by PMD.
Line: 46
}
private static class UnmodifiableIteratorMap<K, V> extends ForwardingMap<K, V> {
final Map<K, V> delegate;
UnmodifiableIteratorMap(Map<K, V> delegate) {
this.delegate = delegate;
}
Reported by PMD.
Line: 46
}
private static class UnmodifiableIteratorMap<K, V> extends ForwardingMap<K, V> {
final Map<K, V> delegate;
UnmodifiableIteratorMap(Map<K, V> delegate) {
this.delegate = delegate;
}
Reported by PMD.
Line: 67
@Override
public Iterator<K> iterator() {
return Iterators.unmodifiableIterator(delegate.keySet().iterator());
}
@Override
public boolean removeAll(Collection<?> c) {
return delegate.keySet().removeAll(c);
Reported by PMD.
Line: 72
@Override
public boolean removeAll(Collection<?> c) {
return delegate.keySet().removeAll(c);
}
@Override
public boolean retainAll(Collection<?> c) {
return delegate.keySet().retainAll(c);
Reported by PMD.
Line: 77
@Override
public boolean retainAll(Collection<?> c) {
return delegate.keySet().retainAll(c);
}
};
}
@Override
Reported by PMD.
Line: 92
@Override
public Iterator<V> iterator() {
return Iterators.unmodifiableIterator(delegate.values().iterator());
}
@Override
public boolean removeAll(Collection<?> c) {
return delegate.values().removeAll(c);
Reported by PMD.
Line: 97
@Override
public boolean removeAll(Collection<?> c) {
return delegate.values().removeAll(c);
}
@Override
public boolean retainAll(Collection<?> c) {
return delegate.values().retainAll(c);
Reported by PMD.
Line: 102
@Override
public boolean retainAll(Collection<?> c) {
return delegate.values().retainAll(c);
}
};
}
@Override
Reported by PMD.
Line: 117
@Override
public Iterator<Entry<K, V>> iterator() {
return Iterators.unmodifiableIterator(delegate.entrySet().iterator());
}
@Override
public boolean removeAll(Collection<?> c) {
return delegate.entrySet().removeAll(c);
Reported by PMD.
guava-tests/test/com/google/common/collect/Collections2Test.java
118 issues
Line: 51
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class Collections2Test extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite(Collections2Test.class.getSimpleName());
suite.addTest(testsForFilter());
suite.addTest(testsForFilterAll());
Reported by PMD.
Line: 52
*/
@GwtCompatible(emulated = true)
public class Collections2Test extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite(Collections2Test.class.getSimpleName());
suite.addTest(testsForFilter());
suite.addTest(testsForFilterAll());
suite.addTest(testsForFilterLinkedList());
Reported by PMD.
Line: 69
new Predicate<String>() {
@Override
public boolean apply(String input) {
return !"yyy".equals(input) && !"zzz".equals(input);
}
};
static final Predicate<String> LENGTH_1 =
new Predicate<String>() {
Reported by PMD.
Line: 69
new Predicate<String>() {
@Override
public boolean apply(String input) {
return !"yyy".equals(input) && !"zzz".equals(input);
}
};
static final Predicate<String> LENGTH_1 =
new Predicate<String>() {
Reported by PMD.
Line: 85
new Predicate<String>() {
@Override
public boolean apply(String input) {
return asList('a', 'e', 'i', 'o', 'u').contains(input.charAt(0));
}
};
@GwtIncompatible // suite
private static Test testsForFilter() {
Reported by PMD.
Line: 96
@Override
public Collection<String> create(String[] elements) {
List<String> unfiltered = newArrayList();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
}
})
Reported by PMD.
Line: 98
List<String> unfiltered = newArrayList();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
}
})
.named("Collections2.filter")
.withFeatures(
Reported by PMD.
Line: 140
@Override
public Collection<String> create(String[] elements) {
List<String> unfiltered = newLinkedList();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
}
})
Reported by PMD.
Line: 142
List<String> unfiltered = newLinkedList();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
}
})
.named("Collections2.filter")
.withFeatures(
Reported by PMD.
Line: 163
@Override
public Collection<String> create(String[] elements) {
List<String> unfiltered = newArrayList();
unfiltered.add("yyy");
unfiltered.addAll(ImmutableList.copyOf(elements));
unfiltered.add("zzz");
return Collections2.filter(unfiltered, LENGTH_1);
}
})
Reported by PMD.
guava-tests/test/com/google/common/collect/ObjectArraysTest.java
118 issues
Line: 35
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class ObjectArraysTest extends TestCase {
@GwtIncompatible // NullPointerTester
public void testNullPointerExceptions() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(ObjectArrays.class);
Reported by PMD.
Line: 37
@GwtCompatible(emulated = true)
public class ObjectArraysTest extends TestCase {
@GwtIncompatible // NullPointerTester
public void testNullPointerExceptions() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(ObjectArrays.class);
}
Reported by PMD.
Line: 38
public class ObjectArraysTest extends TestCase {
@GwtIncompatible // NullPointerTester
public void testNullPointerExceptions() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(ObjectArrays.class);
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
Reported by PMD.
Line: 43
tester.testAllPublicStaticMethods(ObjectArrays.class);
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
Reported by PMD.
Line: 44
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
Reported by PMD.
Line: 46
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
Reported by PMD.
Line: 46
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
Reported by PMD.
Line: 47
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
String[] array = ObjectArrays.newArray(String.class, 2);
Reported by PMD.
Line: 50
assertThat(empty).isEmpty();
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
String[] array = ObjectArrays.newArray(String.class, 2);
assertEquals(String[].class, array.getClass());
assertThat(array).hasLength(2);
assertNull(array[0]);
Reported by PMD.
Line: 51
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
String[] array = ObjectArrays.newArray(String.class, 2);
assertEquals(String[].class, array.getClass());
assertThat(array).hasLength(2);
assertNull(array[0]);
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ObjectArraysTest.java
118 issues
Line: 35
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class ObjectArraysTest extends TestCase {
@GwtIncompatible // NullPointerTester
public void testNullPointerExceptions() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(ObjectArrays.class);
Reported by PMD.
Line: 37
@GwtCompatible(emulated = true)
public class ObjectArraysTest extends TestCase {
@GwtIncompatible // NullPointerTester
public void testNullPointerExceptions() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(ObjectArrays.class);
}
Reported by PMD.
Line: 38
public class ObjectArraysTest extends TestCase {
@GwtIncompatible // NullPointerTester
public void testNullPointerExceptions() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(ObjectArrays.class);
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
Reported by PMD.
Line: 43
tester.testAllPublicStaticMethods(ObjectArrays.class);
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
Reported by PMD.
Line: 44
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
Reported by PMD.
Line: 46
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
Reported by PMD.
Line: 46
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
Reported by PMD.
Line: 47
public void testNewArray_fromClass_Empty() {
String[] empty = ObjectArrays.newArray(String.class, 0);
assertEquals(String[].class, empty.getClass());
assertThat(empty).isEmpty();
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
String[] array = ObjectArrays.newArray(String.class, 2);
Reported by PMD.
Line: 50
assertThat(empty).isEmpty();
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
String[] array = ObjectArrays.newArray(String.class, 2);
assertEquals(String[].class, array.getClass());
assertThat(array).hasLength(2);
assertNull(array[0]);
Reported by PMD.
Line: 51
}
@GwtIncompatible // ObjectArrays.newArray(Class, int)
public void testNewArray_fromClass_Nonempty() {
String[] array = ObjectArrays.newArray(String.class, 2);
assertEquals(String[].class, array.getClass());
assertThat(array).hasLength(2);
assertNull(array[0]);
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/Collections2Test.java
118 issues
Line: 51
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class Collections2Test extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite(Collections2Test.class.getSimpleName());
suite.addTest(testsForFilter());
suite.addTest(testsForFilterAll());
Reported by PMD.
Line: 52
*/
@GwtCompatible(emulated = true)
public class Collections2Test extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite(Collections2Test.class.getSimpleName());
suite.addTest(testsForFilter());
suite.addTest(testsForFilterAll());
suite.addTest(testsForFilterLinkedList());
Reported by PMD.
Line: 69
new Predicate<String>() {
@Override
public boolean apply(String input) {
return !"yyy".equals(input) && !"zzz".equals(input);
}
};
static final Predicate<String> LENGTH_1 =
new Predicate<String>() {
Reported by PMD.
Line: 69
new Predicate<String>() {
@Override
public boolean apply(String input) {
return !"yyy".equals(input) && !"zzz".equals(input);
}
};
static final Predicate<String> LENGTH_1 =
new Predicate<String>() {
Reported by PMD.
Line: 85
new Predicate<String>() {
@Override
public boolean apply(String input) {
return asList('a', 'e', 'i', 'o', 'u').contains(input.charAt(0));
}
};
@GwtIncompatible // suite
private static Test testsForFilter() {
Reported by PMD.
Line: 96
@Override
public Collection<String> create(String[] elements) {
List<String> unfiltered = newArrayList();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
}
})
Reported by PMD.
Line: 98
List<String> unfiltered = newArrayList();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
}
})
.named("Collections2.filter")
.withFeatures(
Reported by PMD.
Line: 140
@Override
public Collection<String> create(String[] elements) {
List<String> unfiltered = newLinkedList();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
}
})
Reported by PMD.
Line: 142
List<String> unfiltered = newLinkedList();
unfiltered.add("yyy");
Collections.addAll(unfiltered, elements);
unfiltered.add("zzz");
return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
}
})
.named("Collections2.filter")
.withFeatures(
Reported by PMD.
Line: 163
@Override
public Collection<String> create(String[] elements) {
List<String> unfiltered = newArrayList();
unfiltered.add("yyy");
unfiltered.addAll(ImmutableList.copyOf(elements));
unfiltered.add("zzz");
return Collections2.filter(unfiltered, LENGTH_1);
}
})
Reported by PMD.
guava-testlib/test/com/google/common/testing/FreshValueGeneratorTest.java
117 issues
Line: 17
* limitations under the License.
*/
package com.google.common.testing;
import com.google.common.base.CharMatcher;
import com.google.common.base.Equivalence;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.testing;
import com.google.common.base.CharMatcher;
import com.google.common.base.Equivalence;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.testing;
import com.google.common.base.CharMatcher;
import com.google.common.base.Equivalence;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
Reported by PMD.
Line: 119
*
* @author Ben Yu
*/
public class FreshValueGeneratorTest extends TestCase {
@AndroidIncompatible // problem with equality of Type objects?
public void testFreshInstance() {
assertFreshInstances(
String.class,
Reported by PMD.
Line: 119
*
* @author Ben Yu
*/
public class FreshValueGeneratorTest extends TestCase {
@AndroidIncompatible // problem with equality of Type objects?
public void testFreshInstance() {
assertFreshInstances(
String.class,
Reported by PMD.
Line: 121
*/
public class FreshValueGeneratorTest extends TestCase {
@AndroidIncompatible // problem with equality of Type objects?
public void testFreshInstance() {
assertFreshInstances(
String.class,
CharSequence.class,
Appendable.class,
Reported by PMD.
Line: 197
int[].class);
}
public void testStringArray() {
FreshValueGenerator generator = new FreshValueGenerator();
String[] a1 = generator.generateFresh(String[].class);
String[] a2 = generator.generateFresh(String[].class);
assertFalse(a1[0].equals(a2[0]));
}
Reported by PMD.
Line: 201
FreshValueGenerator generator = new FreshValueGenerator();
String[] a1 = generator.generateFresh(String[].class);
String[] a2 = generator.generateFresh(String[].class);
assertFalse(a1[0].equals(a2[0]));
}
public void testPrimitiveArray() {
FreshValueGenerator generator = new FreshValueGenerator();
int[] a1 = generator.generateFresh(int[].class);
Reported by PMD.
Line: 204
assertFalse(a1[0].equals(a2[0]));
}
public void testPrimitiveArray() {
FreshValueGenerator generator = new FreshValueGenerator();
int[] a1 = generator.generateFresh(int[].class);
int[] a2 = generator.generateFresh(int[].class);
assertTrue(a1[0] != a2[0]);
}
Reported by PMD.
Line: 208
FreshValueGenerator generator = new FreshValueGenerator();
int[] a1 = generator.generateFresh(int[].class);
int[] a2 = generator.generateFresh(int[].class);
assertTrue(a1[0] != a2[0]);
}
public void testRange() {
assertFreshInstance(new TypeToken<Range<String>>() {});
}
Reported by PMD.
android/guava/src/com/google/common/collect/TreeRangeMap.java
117 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.Predicates.compose;
import static com.google.common.base.Predicates.in;
Reported by PMD.
Line: 55
@Beta
@GwtIncompatible // NavigableMap
@ElementTypesAreNonnullByDefault
public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K, V> {
private final NavigableMap<Cut<K>, RangeMapEntry<K, V>> entriesByLowerBound;
public static <K extends Comparable, V> TreeRangeMap<K, V> create() {
return new TreeRangeMap<>();
Reported by PMD.
Line: 57
@ElementTypesAreNonnullByDefault
public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K, V> {
private final NavigableMap<Cut<K>, RangeMapEntry<K, V>> entriesByLowerBound;
public static <K extends Comparable, V> TreeRangeMap<K, V> create() {
return new TreeRangeMap<>();
}
Reported by PMD.
Line: 69
private static final class RangeMapEntry<K extends Comparable, V>
extends AbstractMapEntry<Range<K>, V> {
private final Range<K> range;
private final V value;
RangeMapEntry(Cut<K> lowerBound, Cut<K> upperBound, V value) {
this(Range.create(lowerBound, upperBound), value);
}
Reported by PMD.
Line: 108
@CheckForNull
public V get(K key) {
Entry<Range<K>, V> entry = getEntry(key);
return (entry == null) ? null : entry.getValue();
}
@Override
@CheckForNull
public Entry<Range<K>, V> getEntry(K key) {
Reported by PMD.
Line: 116
public Entry<Range<K>, V> getEntry(K key) {
Entry<Cut<K>, RangeMapEntry<K, V>> mapEntry =
entriesByLowerBound.floorEntry(Cut.belowValue(key));
if (mapEntry != null && mapEntry.getValue().contains(key)) {
return mapEntry.getValue();
} else {
return null;
}
}
Reported by PMD.
Line: 116
public Entry<Range<K>, V> getEntry(K key) {
Entry<Cut<K>, RangeMapEntry<K, V>> mapEntry =
entriesByLowerBound.floorEntry(Cut.belowValue(key));
if (mapEntry != null && mapEntry.getValue().contains(key)) {
return mapEntry.getValue();
} else {
return null;
}
}
Reported by PMD.
Line: 162
private static <K extends Comparable, V> Range<K> coalesce(
Range<K> range, V value, @CheckForNull Entry<Cut<K>, RangeMapEntry<K, V>> entry) {
if (entry != null
&& entry.getValue().getKey().isConnected(range)
&& entry.getValue().getValue().equals(value)) {
return range.span(entry.getValue().getKey());
}
return range;
}
Reported by PMD.
Line: 162
private static <K extends Comparable, V> Range<K> coalesce(
Range<K> range, V value, @CheckForNull Entry<Cut<K>, RangeMapEntry<K, V>> entry) {
if (entry != null
&& entry.getValue().getKey().isConnected(range)
&& entry.getValue().getValue().equals(value)) {
return range.span(entry.getValue().getKey());
}
return range;
}
Reported by PMD.
Line: 163
Range<K> range, V value, @CheckForNull Entry<Cut<K>, RangeMapEntry<K, V>> entry) {
if (entry != null
&& entry.getValue().getKey().isConnected(range)
&& entry.getValue().getValue().equals(value)) {
return range.span(entry.getValue().getKey());
}
return range;
}
Reported by PMD.
guava/src/com/google/common/util/concurrent/Monitor.java
116 issues
Line: 1210
/** Caller should check before calling that guard is not satisfied. */
@GuardedBy("lock")
private boolean awaitNanos(Guard guard, long nanos, boolean signalBeforeWaiting)
throws InterruptedException {
boolean firstTime = true;
try {
do {
if (nanos <= 0L) {
Reported by PMD.
Line: 207
@GwtIncompatible
@SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress.
@ElementTypesAreNonnullByDefault
public final class Monitor {
// TODO(user): Use raw LockSupport or AbstractQueuedSynchronizer instead of ReentrantLock.
// TODO(user): "Port" jsr166 tests for ReentrantLock.
//
// TODO(user): Change API to make it impossible to use a Guard with the "wrong" monitor,
// by making the monitor implicit, and to eliminate other sources of IMSE.
Reported by PMD.
Line: 207
@GwtIncompatible
@SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress.
@ElementTypesAreNonnullByDefault
public final class Monitor {
// TODO(user): Use raw LockSupport or AbstractQueuedSynchronizer instead of ReentrantLock.
// TODO(user): "Port" jsr166 tests for ReentrantLock.
//
// TODO(user): Change API to make it impossible to use a Guard with the "wrong" monitor,
// by making the monitor implicit, and to eliminate other sources of IMSE.
Reported by PMD.
Line: 207
@GwtIncompatible
@SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress.
@ElementTypesAreNonnullByDefault
public final class Monitor {
// TODO(user): Use raw LockSupport or AbstractQueuedSynchronizer instead of ReentrantLock.
// TODO(user): "Port" jsr166 tests for ReentrantLock.
//
// TODO(user): Change API to make it impossible to use a Guard with the "wrong" monitor,
// by making the monitor implicit, and to eliminate other sources of IMSE.
Reported by PMD.
Line: 207
@GwtIncompatible
@SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress.
@ElementTypesAreNonnullByDefault
public final class Monitor {
// TODO(user): Use raw LockSupport or AbstractQueuedSynchronizer instead of ReentrantLock.
// TODO(user): "Port" jsr166 tests for ReentrantLock.
//
// TODO(user): Change API to make it impossible to use a Guard with the "wrong" monitor,
// by making the monitor implicit, and to eliminate other sources of IMSE.
Reported by PMD.
Line: 207
@GwtIncompatible
@SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress.
@ElementTypesAreNonnullByDefault
public final class Monitor {
// TODO(user): Use raw LockSupport or AbstractQueuedSynchronizer instead of ReentrantLock.
// TODO(user): "Port" jsr166 tests for ReentrantLock.
//
// TODO(user): Change API to make it impossible to use a Guard with the "wrong" monitor,
// by making the monitor implicit, and to eliminate other sources of IMSE.
Reported by PMD.
Line: 207
@GwtIncompatible
@SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress.
@ElementTypesAreNonnullByDefault
public final class Monitor {
// TODO(user): Use raw LockSupport or AbstractQueuedSynchronizer instead of ReentrantLock.
// TODO(user): "Port" jsr166 tests for ReentrantLock.
//
// TODO(user): Change API to make it impossible to use a Guard with the "wrong" monitor,
// by making the monitor implicit, and to eliminate other sources of IMSE.
Reported by PMD.
Line: 310
@Beta
public abstract static class Guard {
@Weak final Monitor monitor;
final Condition condition;
@GuardedBy("monitor.lock")
int waiterCount = 0;
Reported by PMD.
Line: 311
public abstract static class Guard {
@Weak final Monitor monitor;
final Condition condition;
@GuardedBy("monitor.lock")
int waiterCount = 0;
/** The next active guard */
Reported by PMD.
Line: 314
final Condition condition;
@GuardedBy("monitor.lock")
int waiterCount = 0;
/** The next active guard */
@GuardedBy("monitor.lock")
@CheckForNull
Guard next;
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java
115 issues
Line: 157
@Override
public void run() {
numCalls.incrementAndGet();
throw new RuntimeException("FAKE EXCEPTION!");
}
};
e.execute(runMe);
e.execute(runMe);
Reported by PMD.
Line: 299
try {
barrier.await();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
executor.execute(errorTask);
service.execute(barrierTask); // submit directly to the service
Reported by PMD.
Line: 46
*
* @author JJ Furman
*/
public class SequentialExecutorTest extends TestCase {
private static class FakeExecutor implements Executor {
Queue<Runnable> tasks = Queues.newArrayDeque();
@Override
Reported by PMD.
Line: 49
public class SequentialExecutorTest extends TestCase {
private static class FakeExecutor implements Executor {
Queue<Runnable> tasks = Queues.newArrayDeque();
@Override
public void execute(Runnable command) {
tasks.add(command);
}
Reported by PMD.
Line: 62
void runNext() {
assertTrue("expected at least one task to run", hasNext());
tasks.remove().run();
}
void runAll() {
while (hasNext()) {
runNext();
Reported by PMD.
Line: 72
}
}
private FakeExecutor fakePool;
private SequentialExecutor e;
@Override
public void setUp() {
fakePool = new FakeExecutor();
Reported by PMD.
Line: 73
}
private FakeExecutor fakePool;
private SequentialExecutor e;
@Override
public void setUp() {
fakePool = new FakeExecutor();
e = new SequentialExecutor(fakePool);
Reported by PMD.
Line: 75
private FakeExecutor fakePool;
private SequentialExecutor e;
@Override
public void setUp() {
fakePool = new FakeExecutor();
e = new SequentialExecutor(fakePool);
}
Reported by PMD.
Line: 81
e = new SequentialExecutor(fakePool);
}
public void testConstructingWithNullExecutor_fails() {
try {
new SequentialExecutor(null);
fail("Should have failed with NullPointerException.");
} catch (NullPointerException expected) {
}
Reported by PMD.
Line: 84
public void testConstructingWithNullExecutor_fails() {
try {
new SequentialExecutor(null);
fail("Should have failed with NullPointerException.");
} catch (NullPointerException expected) {
}
}
public void testBasics() {
Reported by PMD.