The following issues were found
android/guava/src/com/google/common/graph/IncidentEdgeSet.java
8 issues
Line: 29
*/
@ElementTypesAreNonnullByDefault
abstract class IncidentEdgeSet<N> extends AbstractSet<EndpointPair<N>> {
final N node;
final BaseGraph<N> graph;
IncidentEdgeSet(BaseGraph<N> graph, N node) {
this.graph = graph;
this.node = node;
Reported by PMD.
Line: 30
@ElementTypesAreNonnullByDefault
abstract class IncidentEdgeSet<N> extends AbstractSet<EndpointPair<N>> {
final N node;
final BaseGraph<N> graph;
IncidentEdgeSet(BaseGraph<N> graph, N node) {
this.graph = graph;
this.node = node;
}
Reported by PMD.
Line: 47
if (graph.isDirected()) {
return graph.inDegree(node)
+ graph.outDegree(node)
- (graph.successors(node).contains(node) ? 1 : 0);
} else {
return graph.adjacentNodes(node).size();
}
}
Reported by PMD.
Line: 49
+ graph.outDegree(node)
- (graph.successors(node).contains(node) ? 1 : 0);
} else {
return graph.adjacentNodes(node).size();
}
}
@Override
public boolean contains(@CheckForNull Object obj) {
Reported by PMD.
Line: 67
Object source = endpointPair.source();
Object target = endpointPair.target();
return (node.equals(source) && graph.successors(node).contains(target))
|| (node.equals(target) && graph.predecessors(node).contains(source));
} else {
if (endpointPair.isOrdered()) {
return false;
}
Reported by PMD.
Line: 68
Object source = endpointPair.source();
Object target = endpointPair.target();
return (node.equals(source) && graph.successors(node).contains(target))
|| (node.equals(target) && graph.predecessors(node).contains(source));
} else {
if (endpointPair.isOrdered()) {
return false;
}
Set<N> adjacent = graph.adjacentNodes(node);
Reported by PMD.
Line: 77
Object nodeU = endpointPair.nodeU();
Object nodeV = endpointPair.nodeV();
return (node.equals(nodeV) && adjacent.contains(nodeU))
|| (node.equals(nodeU) && adjacent.contains(nodeV));
}
}
}
Reported by PMD.
Line: 78
Object nodeV = endpointPair.nodeV();
return (node.equals(nodeV) && adjacent.contains(nodeU))
|| (node.equals(nodeU) && adjacent.contains(nodeV));
}
}
}
Reported by PMD.
android/guava/src/com/google/common/graph/NetworkBuilder.java
8 issues
Line: 71
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class NetworkBuilder<N, E> extends AbstractGraphBuilder<N> {
boolean allowsParallelEdges = false;
ElementOrder<? super E> edgeOrder = ElementOrder.insertion();
Optional<Integer> expectedEdgeCount = Optional.absent();
/** Creates a new instance with the specified edge directionality. */
Reported by PMD.
Line: 72
@Beta
@ElementTypesAreNonnullByDefault
public final class NetworkBuilder<N, E> extends AbstractGraphBuilder<N> {
boolean allowsParallelEdges = false;
ElementOrder<? super E> edgeOrder = ElementOrder.insertion();
Optional<Integer> expectedEdgeCount = Optional.absent();
/** Creates a new instance with the specified edge directionality. */
private NetworkBuilder(boolean directed) {
Reported by PMD.
Line: 72
@Beta
@ElementTypesAreNonnullByDefault
public final class NetworkBuilder<N, E> extends AbstractGraphBuilder<N> {
boolean allowsParallelEdges = false;
ElementOrder<? super E> edgeOrder = ElementOrder.insertion();
Optional<Integer> expectedEdgeCount = Optional.absent();
/** Creates a new instance with the specified edge directionality. */
private NetworkBuilder(boolean directed) {
Reported by PMD.
Line: 72
@Beta
@ElementTypesAreNonnullByDefault
public final class NetworkBuilder<N, E> extends AbstractGraphBuilder<N> {
boolean allowsParallelEdges = false;
ElementOrder<? super E> edgeOrder = ElementOrder.insertion();
Optional<Integer> expectedEdgeCount = Optional.absent();
/** Creates a new instance with the specified edge directionality. */
private NetworkBuilder(boolean directed) {
Reported by PMD.
Line: 73
@ElementTypesAreNonnullByDefault
public final class NetworkBuilder<N, E> extends AbstractGraphBuilder<N> {
boolean allowsParallelEdges = false;
ElementOrder<? super E> edgeOrder = ElementOrder.insertion();
Optional<Integer> expectedEdgeCount = Optional.absent();
/** Creates a new instance with the specified edge directionality. */
private NetworkBuilder(boolean directed) {
super(directed);
Reported by PMD.
Line: 73
@ElementTypesAreNonnullByDefault
public final class NetworkBuilder<N, E> extends AbstractGraphBuilder<N> {
boolean allowsParallelEdges = false;
ElementOrder<? super E> edgeOrder = ElementOrder.insertion();
Optional<Integer> expectedEdgeCount = Optional.absent();
/** Creates a new instance with the specified edge directionality. */
private NetworkBuilder(boolean directed) {
super(directed);
Reported by PMD.
Line: 74
public final class NetworkBuilder<N, E> extends AbstractGraphBuilder<N> {
boolean allowsParallelEdges = false;
ElementOrder<? super E> edgeOrder = ElementOrder.insertion();
Optional<Integer> expectedEdgeCount = Optional.absent();
/** Creates a new instance with the specified edge directionality. */
private NetworkBuilder(boolean directed) {
super(directed);
}
Reported by PMD.
Line: 74
public final class NetworkBuilder<N, E> extends AbstractGraphBuilder<N> {
boolean allowsParallelEdges = false;
ElementOrder<? super E> edgeOrder = ElementOrder.insertion();
Optional<Integer> expectedEdgeCount = Optional.absent();
/** Creates a new instance with the specified edge directionality. */
private NetworkBuilder(boolean directed) {
super(directed);
}
Reported by PMD.
android/guava/src/com/google/common/cache/CacheLoader.java
8 issues
Line: 75
* treated like any other {@code Exception} in all respects except that, when it is caught,
* the thread's interrupt status is set
*/
public abstract V load(K key) throws Exception;
/**
* Computes or retrieves a replacement value corresponding to an already-cached {@code key}. This
* method is called when an existing cache entry is refreshed by {@link
* CacheBuilder#refreshAfterWrite}, or through a call to {@link LoadingCache#refresh}.
Reported by PMD.
Line: 99
* @since 11.0
*/
@GwtIncompatible // Futures
public ListenableFuture<V> reload(K key, V oldValue) throws Exception {
checkNotNull(key);
checkNotNull(oldValue);
return Futures.immediateFuture(load(key));
}
Reported by PMD.
Line: 127
* the thread's interrupt status is set
* @since 11.0
*/
public Map<K, V> loadAll(Iterable<? extends K> keys) throws Exception {
// This will be caught by getAll(), causing it to fall back to multiple calls to
// LoadingCache.get
throw new UnsupportedLoadingOperationException();
}
Reported by PMD.
Line: 162
private static final class FunctionToCacheLoader<K, V> extends CacheLoader<K, V>
implements Serializable {
private final Function<K, V> computingFunction;
public FunctionToCacheLoader(Function<K, V> computingFunction) {
this.computingFunction = checkNotNull(computingFunction);
}
Reported by PMD.
Line: 204
new Callable<V>() {
@Override
public V call() throws Exception {
return loader.reload(key, oldValue).get();
}
});
executor.execute(task);
return task;
}
Reported by PMD.
Line: 220
private static final class SupplierToCacheLoader<V> extends CacheLoader<Object, V>
implements Serializable {
private final Supplier<V> computingSupplier;
public SupplierToCacheLoader(Supplier<V> computingSupplier) {
this.computingSupplier = checkNotNull(computingSupplier);
}
Reported by PMD.
Line: 240
*
* @since 19.0
*/
public static final class UnsupportedLoadingOperationException
extends UnsupportedOperationException {
// Package-private because this should only be thrown by loadAll() when it is not overridden.
// Cache implementors may want to catch it but should not need to be able to throw it.
UnsupportedLoadingOperationException() {}
}
Reported by PMD.
Line: 252
*
* @since 11.0
*/
public static final class InvalidCacheLoadException extends RuntimeException {
public InvalidCacheLoadException(String message) {
super(message);
}
}
}
Reported by PMD.
android/guava/src/com/google/common/graph/StandardMutableNetwork.java
8 issues
Line: 88
EndpointPair<N> existingIncidentNodes = incidentNodes(edge);
EndpointPair<N> newIncidentNodes = EndpointPair.of(this, nodeU, nodeV);
checkArgument(
existingIncidentNodes.equals(newIncidentNodes),
REUSING_EDGE,
edge,
existingIncidentNodes,
newIncidentNodes);
return false;
Reported by PMD.
Line: 98
NetworkConnections<N, E> connectionsU = nodeConnections.get(nodeU);
if (!allowsParallelEdges()) {
checkArgument(
!(connectionsU != null && connectionsU.successors().contains(nodeV)),
PARALLEL_EDGES_NOT_ALLOWED,
nodeU,
nodeV);
}
boolean isSelfLoop = nodeU.equals(nodeV);
Reported by PMD.
Line: 111
if (connectionsU == null) {
connectionsU = addNodeInternal(nodeU);
}
connectionsU.addOutEdge(edge, nodeV);
NetworkConnections<N, E> connectionsV = nodeConnections.get(nodeV);
if (connectionsV == null) {
connectionsV = addNodeInternal(nodeV);
}
connectionsV.addInEdge(edge, nodeU, isSelfLoop);
Reported by PMD.
Line: 116
if (connectionsV == null) {
connectionsV = addNodeInternal(nodeV);
}
connectionsV.addInEdge(edge, nodeU, isSelfLoop);
edgeToReferenceNode.put(edge, nodeU);
return true;
}
@Override
Reported by PMD.
Line: 159
// requireNonNull is safe because of the edgeToReferenceNode check above.
NetworkConnections<N, E> connectionsU = requireNonNull(nodeConnections.get(nodeU));
N nodeV = connectionsU.adjacentNode(edge);
NetworkConnections<N, E> connectionsV = requireNonNull(nodeConnections.get(nodeV));
connectionsU.removeOutEdge(edge);
connectionsV.removeInEdge(edge, allowsSelfLoops() && nodeU.equals(nodeV));
edgeToReferenceNode.remove(edge);
return true;
Reported by PMD.
Line: 161
NetworkConnections<N, E> connectionsU = requireNonNull(nodeConnections.get(nodeU));
N nodeV = connectionsU.adjacentNode(edge);
NetworkConnections<N, E> connectionsV = requireNonNull(nodeConnections.get(nodeV));
connectionsU.removeOutEdge(edge);
connectionsV.removeInEdge(edge, allowsSelfLoops() && nodeU.equals(nodeV));
edgeToReferenceNode.remove(edge);
return true;
}
Reported by PMD.
Line: 162
N nodeV = connectionsU.adjacentNode(edge);
NetworkConnections<N, E> connectionsV = requireNonNull(nodeConnections.get(nodeV));
connectionsU.removeOutEdge(edge);
connectionsV.removeInEdge(edge, allowsSelfLoops() && nodeU.equals(nodeV));
edgeToReferenceNode.remove(edge);
return true;
}
private NetworkConnections<N, E> newConnections() {
Reported by PMD.
Line: 162
N nodeV = connectionsU.adjacentNode(edge);
NetworkConnections<N, E> connectionsV = requireNonNull(nodeConnections.get(nodeV));
connectionsU.removeOutEdge(edge);
connectionsV.removeInEdge(edge, allowsSelfLoops() && nodeU.equals(nodeV));
edgeToReferenceNode.remove(edge);
return true;
}
private NetworkConnections<N, E> newConnections() {
Reported by PMD.
android/guava/src/com/google/common/graph/StandardMutableValueGraph.java
8 issues
Line: 47
final class StandardMutableValueGraph<N, V> extends StandardValueGraph<N, V>
implements MutableValueGraph<N, V> {
private final ElementOrder<N> incidentEdgeOrder;
/** Constructs a mutable graph with the properties specified in {@code builder}. */
StandardMutableValueGraph(AbstractGraphBuilder<? super N> builder) {
super(builder);
incidentEdgeOrder = builder.incidentEdgeOrder.cast();
Reported by PMD.
Line: 47
final class StandardMutableValueGraph<N, V> extends StandardValueGraph<N, V>
implements MutableValueGraph<N, V> {
private final ElementOrder<N> incidentEdgeOrder;
/** Constructs a mutable graph with the properties specified in {@code builder}. */
StandardMutableValueGraph(AbstractGraphBuilder<? super N> builder) {
super(builder);
incidentEdgeOrder = builder.incidentEdgeOrder.cast();
Reported by PMD.
Line: 101
if (connectionsU == null) {
connectionsU = addNodeInternal(nodeU);
}
V previousValue = connectionsU.addSuccessor(nodeV, value);
GraphConnections<N, V> connectionsV = nodeConnections.get(nodeV);
if (connectionsV == null) {
connectionsV = addNodeInternal(nodeV);
}
connectionsV.addPredecessor(nodeU, value);
Reported by PMD.
Line: 106
if (connectionsV == null) {
connectionsV = addNodeInternal(nodeV);
}
connectionsV.addPredecessor(nodeU, value);
if (previousValue == null) {
checkPositive(++edgeCount);
}
return previousValue;
}
Reported by PMD.
Line: 133
if (allowsSelfLoops()) {
// Remove self-loop (if any) first, so we don't get CME while removing incident edges.
if (connections.removeSuccessor(node) != null) {
connections.removePredecessor(node);
--edgeCount;
}
}
Reported by PMD.
Line: 141
for (N successor : connections.successors()) {
// requireNonNull is safe because the node is a successor.
requireNonNull(nodeConnections.getWithoutCaching(successor)).removePredecessor(node);
--edgeCount;
}
if (isDirected()) { // In undirected graphs, the successor and predecessor sets are equal.
for (N predecessor : connections.predecessors()) {
// requireNonNull is safe because the node is a predecessor.
Reported by PMD.
Line: 148
for (N predecessor : connections.predecessors()) {
// requireNonNull is safe because the node is a predecessor.
checkState(
requireNonNull(nodeConnections.getWithoutCaching(predecessor)).removeSuccessor(node)
!= null);
--edgeCount;
}
}
nodeConnections.remove(node);
Reported by PMD.
Line: 171
return null;
}
V previousValue = connectionsU.removeSuccessor(nodeV);
if (previousValue != null) {
connectionsV.removePredecessor(nodeU);
checkNonNegative(--edgeCount);
}
return previousValue;
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/ListMultimapTestSuiteBuilder.java
8 issues
Line: 58
@Override
protected List<Class<? extends AbstractTester>> getTesters() {
List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
testers.add(ListMultimapAsMapTester.class);
testers.add(ListMultimapEqualsTester.class);
testers.add(ListMultimapPutTester.class);
testers.add(ListMultimapPutAllTester.class);
testers.add(ListMultimapRemoveTester.class);
testers.add(ListMultimapReplaceValuesTester.class);
Reported by PMD.
Line: 59
protected List<Class<? extends AbstractTester>> getTesters() {
List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
testers.add(ListMultimapAsMapTester.class);
testers.add(ListMultimapEqualsTester.class);
testers.add(ListMultimapPutTester.class);
testers.add(ListMultimapPutAllTester.class);
testers.add(ListMultimapRemoveTester.class);
testers.add(ListMultimapReplaceValuesTester.class);
return testers;
Reported by PMD.
Line: 60
List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
testers.add(ListMultimapAsMapTester.class);
testers.add(ListMultimapEqualsTester.class);
testers.add(ListMultimapPutTester.class);
testers.add(ListMultimapPutAllTester.class);
testers.add(ListMultimapRemoveTester.class);
testers.add(ListMultimapReplaceValuesTester.class);
return testers;
}
Reported by PMD.
Line: 61
testers.add(ListMultimapAsMapTester.class);
testers.add(ListMultimapEqualsTester.class);
testers.add(ListMultimapPutTester.class);
testers.add(ListMultimapPutAllTester.class);
testers.add(ListMultimapRemoveTester.class);
testers.add(ListMultimapReplaceValuesTester.class);
return testers;
}
Reported by PMD.
Line: 62
testers.add(ListMultimapEqualsTester.class);
testers.add(ListMultimapPutTester.class);
testers.add(ListMultimapPutAllTester.class);
testers.add(ListMultimapRemoveTester.class);
testers.add(ListMultimapReplaceValuesTester.class);
return testers;
}
@Override
Reported by PMD.
Line: 63
testers.add(ListMultimapPutTester.class);
testers.add(ListMultimapPutAllTester.class);
testers.add(ListMultimapRemoveTester.class);
testers.add(ListMultimapReplaceValuesTester.class);
return testers;
}
@Override
TestSuite computeMultimapGetTestSuite(
Reported by PMD.
Line: 101
@Override
Set<Feature<?>> computeMultimapGetFeatures(Set<Feature<?>> multimapFeatures) {
Set<Feature<?>> derivedFeatures = super.computeMultimapGetFeatures(multimapFeatures);
if (derivedFeatures.contains(CollectionFeature.SUPPORTS_ADD)) {
derivedFeatures.add(ListFeature.SUPPORTS_ADD_WITH_INDEX);
}
if (derivedFeatures.contains(CollectionFeature.GENERAL_PURPOSE)) {
derivedFeatures.add(ListFeature.GENERAL_PURPOSE);
}
Reported by PMD.
Line: 104
if (derivedFeatures.contains(CollectionFeature.SUPPORTS_ADD)) {
derivedFeatures.add(ListFeature.SUPPORTS_ADD_WITH_INDEX);
}
if (derivedFeatures.contains(CollectionFeature.GENERAL_PURPOSE)) {
derivedFeatures.add(ListFeature.GENERAL_PURPOSE);
}
return derivedFeatures;
}
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/ExecutionList.java
8 issues
Line: 148
// Log it and keep going -- bad runnable and/or executor. Don't punish the other runnables if
// we're given a bad one. We only catch RuntimeException because we want Errors to propagate
// up.
log.log(
Level.SEVERE,
"RuntimeException while executing runnable " + runnable + " with executor " + executor,
e);
}
}
Reported by PMD.
Line: 54
*/
@GuardedBy("this")
@CheckForNull
private RunnableExecutorPair runnables;
@GuardedBy("this")
private boolean executed;
/** Creates a new, empty {@link ExecutionList}. */
Reported by PMD.
Line: 57
private RunnableExecutorPair runnables;
@GuardedBy("this")
private boolean executed;
/** Creates a new, empty {@link ExecutionList}. */
public ExecutionList() {}
/**
Reported by PMD.
Line: 113
}
executed = true;
list = runnables;
runnables = null; // allow GC to free listeners even if this stays around for a while.
}
// If we succeeded then list holds all the runnables we to execute. The pairs in the stack are
// in the opposite order from how they were added so we need to reverse the list to fulfill our
// contract.
// This is somewhat annoying, but turns out to be very fast in practice. Alternatively, we could
Reported by PMD.
Line: 144
private static void executeListener(Runnable runnable, Executor executor) {
try {
executor.execute(runnable);
} catch (RuntimeException e) {
// Log it and keep going -- bad runnable and/or executor. Don't punish the other runnables if
// we're given a bad one. We only catch RuntimeException because we want Errors to propagate
// up.
log.log(
Level.SEVERE,
Reported by PMD.
Line: 156
}
private static final class RunnableExecutorPair {
final Runnable runnable;
final Executor executor;
@CheckForNull RunnableExecutorPair next;
RunnableExecutorPair(
Runnable runnable, Executor executor, @CheckForNull RunnableExecutorPair next) {
Reported by PMD.
Line: 157
private static final class RunnableExecutorPair {
final Runnable runnable;
final Executor executor;
@CheckForNull RunnableExecutorPair next;
RunnableExecutorPair(
Runnable runnable, Executor executor, @CheckForNull RunnableExecutorPair next) {
this.runnable = runnable;
Reported by PMD.
Line: 158
private static final class RunnableExecutorPair {
final Runnable runnable;
final Executor executor;
@CheckForNull RunnableExecutorPair next;
RunnableExecutorPair(
Runnable runnable, Executor executor, @CheckForNull RunnableExecutorPair next) {
this.runnable = runnable;
this.executor = executor;
Reported by PMD.
android/guava/src/com/google/common/hash/LongAdder.java
8 issues
Line: 42
* @author Doug Lea
*/
@ElementTypesAreNonnullByDefault
final class LongAdder extends Striped64 implements Serializable, LongAddable {
private static final long serialVersionUID = 7249069246863182397L;
/** Version of plus for use in retryUpdate */
@Override
final long fn(long v, long x) {
Reported by PMD.
Line: 66
int[] hc;
Cell a;
int n;
if ((as = cells) != null || !casBase(b = base, b + x)) {
boolean uncontended = true;
if ((hc = threadHashCode.get()) == null
|| as == null
|| (n = as.length) < 1
|| (a = as[(n - 1) & hc[0]]) == null
Reported by PMD.
Line: 68
int n;
if ((as = cells) != null || !casBase(b = base, b + x)) {
boolean uncontended = true;
if ((hc = threadHashCode.get()) == null
|| as == null
|| (n = as.length) < 1
|| (a = as[(n - 1) & hc[0]]) == null
|| !(uncontended = a.cas(v = a.value, v + x))) retryUpdate(x, hc, uncontended);
}
Reported by PMD.
Line: 189
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
busy = 0;
cells = null;
base = s.readLong();
}
}
Reported by PMD.
Line: 62
@Override
public void add(long x) {
Cell[] as;
long b, v;
int[] hc;
Cell a;
int n;
if ((as = cells) != null || !casBase(b = base, b + x)) {
boolean uncontended = true;
Reported by PMD.
Line: 66
int[] hc;
Cell a;
int n;
if ((as = cells) != null || !casBase(b = base, b + x)) {
boolean uncontended = true;
if ((hc = threadHashCode.get()) == null
|| as == null
|| (n = as.length) < 1
|| (a = as[(n - 1) & hc[0]]) == null
Reported by PMD.
Line: 67
Cell a;
int n;
if ((as = cells) != null || !casBase(b = base, b + x)) {
boolean uncontended = true;
if ((hc = threadHashCode.get()) == null
|| as == null
|| (n = as.length) < 1
|| (a = as[(n - 1) & hc[0]]) == null
|| !(uncontended = a.cas(v = a.value, v + x))) retryUpdate(x, hc, uncontended);
Reported by PMD.
Line: 68
int n;
if ((as = cells) != null || !casBase(b = base, b + x)) {
boolean uncontended = true;
if ((hc = threadHashCode.get()) == null
|| as == null
|| (n = as.length) < 1
|| (a = as[(n - 1) & hc[0]]) == null
|| !(uncontended = a.cas(v = a.value, v + x))) retryUpdate(x, hc, uncontended);
}
Reported by PMD.
android/guava/src/com/google/common/base/Functions.java
8 issues
Line: 144
private static class FunctionForMapNoDefault<
K extends @Nullable Object, V extends @Nullable Object>
implements Function<K, V>, Serializable {
final Map<K, V> map;
FunctionForMapNoDefault(Map<K, V> map) {
this.map = checkNotNull(map);
}
Reported by PMD.
Line: 183
private static class ForMapWithDefault<K extends @Nullable Object, V extends @Nullable Object>
implements Function<K, V>, Serializable {
final Map<K, ? extends V> map;
@ParametricNullness final V defaultValue;
ForMapWithDefault(Map<K, ? extends V> map, @ParametricNullness V defaultValue) {
this.map = checkNotNull(map);
this.defaultValue = defaultValue;
Reported by PMD.
Line: 184
private static class ForMapWithDefault<K extends @Nullable Object, V extends @Nullable Object>
implements Function<K, V>, Serializable {
final Map<K, ? extends V> map;
@ParametricNullness final V defaultValue;
ForMapWithDefault(Map<K, ? extends V> map, @ParametricNullness V defaultValue) {
this.map = checkNotNull(map);
this.defaultValue = defaultValue;
}
Reported by PMD.
Line: 244
private static class FunctionComposition<
A extends @Nullable Object, B extends @Nullable Object, C extends @Nullable Object>
implements Function<A, C>, Serializable {
private final Function<B, C> g;
private final Function<A, ? extends B> f;
public FunctionComposition(Function<B, C> g, Function<A, ? extends B> f) {
this.g = checkNotNull(g);
this.f = checkNotNull(f);
Reported by PMD.
Line: 245
A extends @Nullable Object, B extends @Nullable Object, C extends @Nullable Object>
implements Function<A, C>, Serializable {
private final Function<B, C> g;
private final Function<A, ? extends B> f;
public FunctionComposition(Function<B, C> g, Function<A, ? extends B> f) {
this.g = checkNotNull(g);
this.f = checkNotNull(f);
}
Reported by PMD.
Line: 297
/** @see Functions#forPredicate */
private static class PredicateFunction<T extends @Nullable Object>
implements Function<T, Boolean>, Serializable {
private final Predicate<T> predicate;
private PredicateFunction(Predicate<T> predicate) {
this.predicate = checkNotNull(predicate);
}
Reported by PMD.
Line: 345
private static class ConstantFunction<E extends @Nullable Object>
implements Function<@Nullable Object, E>, Serializable {
@ParametricNullness private final E value;
public ConstantFunction(@ParametricNullness E value) {
this.value = value;
}
Reported by PMD.
Line: 395
private static class SupplierFunction<F extends @Nullable Object, T extends @Nullable Object>
implements Function<F, T>, Serializable {
private final Supplier<T> supplier;
private SupplierFunction(Supplier<T> supplier) {
this.supplier = checkNotNull(supplier);
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/MultimapValuesTester.java
8 issues
Line: 41
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapValuesTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
public void testValues() {
List<V> expected = Lists.newArrayList();
for (Entry<K, V> entry : getSampleElements()) {
expected.add(entry.getValue());
}
assertEqualIgnoringOrder(expected, multimap().values());
Reported by PMD.
Line: 46
for (Entry<K, V> entry : getSampleElements()) {
expected.add(entry.getValue());
}
assertEqualIgnoringOrder(expected, multimap().values());
}
@CollectionFeature.Require(KNOWN_ORDER)
public void testValuesInOrder() {
List<V> expected = Lists.newArrayList();
Reported by PMD.
Line: 49
assertEqualIgnoringOrder(expected, multimap().values());
}
@CollectionFeature.Require(KNOWN_ORDER)
public void testValuesInOrder() {
List<V> expected = Lists.newArrayList();
for (Entry<K, V> entry : getOrderedElements()) {
expected.add(entry.getValue());
}
Reported by PMD.
Line: 55
for (Entry<K, V> entry : getOrderedElements()) {
expected.add(entry.getValue());
}
assertEqualInOrder(expected, multimap().values());
}
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
@CollectionSize.Require(ONE)
public void testValuesIteratorRemove() {
Reported by PMD.
Line: 58
assertEqualInOrder(expected, multimap().values());
}
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
@CollectionSize.Require(ONE)
public void testValuesIteratorRemove() {
Iterator<V> valuesItr = multimap().values().iterator();
valuesItr.next();
valuesItr.remove();
Reported by PMD.
Line: 61
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
@CollectionSize.Require(ONE)
public void testValuesIteratorRemove() {
Iterator<V> valuesItr = multimap().values().iterator();
valuesItr.next();
valuesItr.remove();
assertTrue(multimap().isEmpty());
}
}
Reported by PMD.
Line: 61
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
@CollectionSize.Require(ONE)
public void testValuesIteratorRemove() {
Iterator<V> valuesItr = multimap().values().iterator();
valuesItr.next();
valuesItr.remove();
assertTrue(multimap().isEmpty());
}
}
Reported by PMD.
Line: 64
Iterator<V> valuesItr = multimap().values().iterator();
valuesItr.next();
valuesItr.remove();
assertTrue(multimap().isEmpty());
}
}
Reported by PMD.