The following issues were found
android/guava/src/com/google/common/base/Joiner.java
18 issues
Line: 69
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
public class Joiner {
/** Returns a joiner which automatically places {@code separator} between consecutive elements. */
public static Joiner on(String separator) {
return new Joiner(separator);
}
Reported by PMD.
Line: 80
return new Joiner(String.valueOf(separator));
}
private final String separator;
private Joiner(String separator) {
this.separator = checkNotNull(separator);
}
Reported by PMD.
Line: 244
return new Joiner(this) {
@Override
CharSequence toString(@CheckForNull Object part) {
return (part == null) ? nullText : Joiner.this.toString(part);
}
@Override
public Joiner useForNull(String nullText) {
throw new UnsupportedOperationException("already specified useForNull");
Reported by PMD.
Line: 244
return new Joiner(this) {
@Override
CharSequence toString(@CheckForNull Object part) {
return (part == null) ? nullText : Joiner.this.toString(part);
}
@Override
public Joiner useForNull(String nullText) {
throw new UnsupportedOperationException("already specified useForNull");
Reported by PMD.
Line: 273
while (parts.hasNext()) {
Object part = parts.next();
if (part != null) {
appendable.append(Joiner.this.toString(part));
break;
}
}
while (parts.hasNext()) {
Object part = parts.next();
Reported by PMD.
Line: 273
while (parts.hasNext()) {
Object part = parts.next();
if (part != null) {
appendable.append(Joiner.this.toString(part));
break;
}
}
while (parts.hasNext()) {
Object part = parts.next();
Reported by PMD.
Line: 281
Object part = parts.next();
if (part != null) {
appendable.append(separator);
appendable.append(Joiner.this.toString(part));
}
}
return appendable;
}
Reported by PMD.
Line: 281
Object part = parts.next();
if (part != null) {
appendable.append(separator);
appendable.append(Joiner.this.toString(part));
}
}
return appendable;
}
Reported by PMD.
Line: 336
* @since 2.0
*/
public static final class MapJoiner {
private final Joiner joiner;
private final String keyValueSeparator;
private MapJoiner(Joiner joiner, String keyValueSeparator) {
this.joiner = joiner; // only "this" is ever passed, so don't checkNotNull
this.keyValueSeparator = checkNotNull(keyValueSeparator);
Reported by PMD.
Line: 337
*/
public static final class MapJoiner {
private final Joiner joiner;
private final String keyValueSeparator;
private MapJoiner(Joiner joiner, String keyValueSeparator) {
this.joiner = joiner; // only "this" is ever passed, so don't checkNotNull
this.keyValueSeparator = checkNotNull(keyValueSeparator);
}
Reported by PMD.
android/guava/src/com/google/common/primitives/Ints.java
18 issues
Line: 188
continue outer;
}
}
return i;
}
return -1;
}
/**
Reported by PMD.
Line: 48
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Ints extends IntsMethodsForWeb {
private Ints() {}
/**
* The number of bytes required to represent a primitive {@code int} value.
*
Reported by PMD.
Line: 48
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Ints extends IntsMethodsForWeb {
private Ints() {}
/**
* The number of bytes required to represent a primitive {@code int} value.
*
Reported by PMD.
Line: 506
public static void reverse(int[] array, int fromIndex, int toIndex) {
checkNotNull(array);
checkPositionIndexes(fromIndex, toIndex, array.length);
for (int i = fromIndex, j = toIndex - 1; i < j; i++, j--) {
int tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
}
Reported by PMD.
Line: 566
@GwtCompatible
private static class IntArrayAsList extends AbstractList<Integer>
implements RandomAccess, Serializable {
final int[] array;
final int start;
final int end;
IntArrayAsList(int[] array) {
this(array, 0, array.length);
Reported by PMD.
Line: 567
private static class IntArrayAsList extends AbstractList<Integer>
implements RandomAccess, Serializable {
final int[] array;
final int start;
final int end;
IntArrayAsList(int[] array) {
this(array, 0, array.length);
}
Reported by PMD.
Line: 568
implements RandomAccess, Serializable {
final int[] array;
final int start;
final int end;
IntArrayAsList(int[] array) {
this(array, 0, array.length);
}
Reported by PMD.
Line: 574
this(array, 0, array.length);
}
IntArrayAsList(int[] array, int start, int end) {
this.array = array;
this.start = start;
this.end = end;
}
Reported by PMD.
Line: 653
if (object instanceof IntArrayAsList) {
IntArrayAsList that = (IntArrayAsList) object;
int size = size();
if (that.size() != size) {
return false;
}
for (int i = 0; i < size; i++) {
if (array[start + i] != that.array[that.start + i]) {
return false;
Reported by PMD.
Line: 739
@CheckForNull
public static Integer tryParse(String string, int radix) {
Long result = Longs.tryParse(string, radix);
if (result == null || result.longValue() != result.intValue()) {
return null;
} else {
return result.intValue();
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/reflect/AbstractInvocationHandlerTest.java
18 issues
Line: 40
private static final ImmutableList<String> LIST1 = ImmutableList.of("one", "two");
private static final ImmutableList<String> LIST2 = ImmutableList.of("three");
public void testDelegate() {
assertEquals(LIST1, ImmutableList.copyOf(newDelegatingList(LIST1)));
assertEquals(LIST1, ImmutableList.copyOf(newDelegatingListWithEquals(LIST1)));
}
public void testToString() {
Reported by PMD.
Line: 40
private static final ImmutableList<String> LIST1 = ImmutableList.of("one", "two");
private static final ImmutableList<String> LIST2 = ImmutableList.of("three");
public void testDelegate() {
assertEquals(LIST1, ImmutableList.copyOf(newDelegatingList(LIST1)));
assertEquals(LIST1, ImmutableList.copyOf(newDelegatingListWithEquals(LIST1)));
}
public void testToString() {
Reported by PMD.
Line: 41
private static final ImmutableList<String> LIST2 = ImmutableList.of("three");
public void testDelegate() {
assertEquals(LIST1, ImmutableList.copyOf(newDelegatingList(LIST1)));
assertEquals(LIST1, ImmutableList.copyOf(newDelegatingListWithEquals(LIST1)));
}
public void testToString() {
List<String> proxy = newDelegatingList(LIST1);
Reported by PMD.
Line: 42
public void testDelegate() {
assertEquals(LIST1, ImmutableList.copyOf(newDelegatingList(LIST1)));
assertEquals(LIST1, ImmutableList.copyOf(newDelegatingListWithEquals(LIST1)));
}
public void testToString() {
List<String> proxy = newDelegatingList(LIST1);
assertEquals(Proxy.getInvocationHandler(proxy).toString(), proxy.toString());
Reported by PMD.
Line: 45
assertEquals(LIST1, ImmutableList.copyOf(newDelegatingListWithEquals(LIST1)));
}
public void testToString() {
List<String> proxy = newDelegatingList(LIST1);
assertEquals(Proxy.getInvocationHandler(proxy).toString(), proxy.toString());
}
interface A {}
Reported by PMD.
Line: 47
public void testToString() {
List<String> proxy = newDelegatingList(LIST1);
assertEquals(Proxy.getInvocationHandler(proxy).toString(), proxy.toString());
}
interface A {}
interface B {}
Reported by PMD.
Line: 47
public void testToString() {
List<String> proxy = newDelegatingList(LIST1);
assertEquals(Proxy.getInvocationHandler(proxy).toString(), proxy.toString());
}
interface A {}
interface B {}
Reported by PMD.
Line: 47
public void testToString() {
List<String> proxy = newDelegatingList(LIST1);
assertEquals(Proxy.getInvocationHandler(proxy).toString(), proxy.toString());
}
interface A {}
interface B {}
Reported by PMD.
Line: 54
interface B {}
public void testEquals() {
class AB implements A, B {}
class BA implements B, A {}
AB ab = new AB();
BA ba = new BA();
new EqualsTester()
Reported by PMD.
Line: 54
interface B {}
public void testEquals() {
class AB implements A, B {}
class BA implements B, A {}
AB ab = new AB();
BA ba = new BA();
new EqualsTester()
Reported by PMD.
android/guava/src/com/google/common/graph/StandardValueGraph.java
18 issues
Line: 47
* @param <V> Value parameter type
*/
@ElementTypesAreNonnullByDefault
class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> {
private final boolean isDirected;
private final boolean allowsSelfLoops;
private final ElementOrder<N> nodeOrder;
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
Reported by PMD.
Line: 48
*/
@ElementTypesAreNonnullByDefault
class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> {
private final boolean isDirected;
private final boolean allowsSelfLoops;
private final ElementOrder<N> nodeOrder;
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
Reported by PMD.
Line: 48
*/
@ElementTypesAreNonnullByDefault
class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> {
private final boolean isDirected;
private final boolean allowsSelfLoops;
private final ElementOrder<N> nodeOrder;
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
Reported by PMD.
Line: 49
@ElementTypesAreNonnullByDefault
class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> {
private final boolean isDirected;
private final boolean allowsSelfLoops;
private final ElementOrder<N> nodeOrder;
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
long edgeCount; // must be updated when edges are added or removed
Reported by PMD.
Line: 49
@ElementTypesAreNonnullByDefault
class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> {
private final boolean isDirected;
private final boolean allowsSelfLoops;
private final ElementOrder<N> nodeOrder;
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
long edgeCount; // must be updated when edges are added or removed
Reported by PMD.
Line: 50
class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> {
private final boolean isDirected;
private final boolean allowsSelfLoops;
private final ElementOrder<N> nodeOrder;
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
long edgeCount; // must be updated when edges are added or removed
Reported by PMD.
Line: 50
class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> {
private final boolean isDirected;
private final boolean allowsSelfLoops;
private final ElementOrder<N> nodeOrder;
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
long edgeCount; // must be updated when edges are added or removed
Reported by PMD.
Line: 52
private final boolean allowsSelfLoops;
private final ElementOrder<N> nodeOrder;
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
long edgeCount; // must be updated when edges are added or removed
/** Constructs a graph with the properties specified in {@code builder}. */
StandardValueGraph(AbstractGraphBuilder<? super N> builder) {
Reported by PMD.
Line: 54
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
long edgeCount; // must be updated when edges are added or removed
/** Constructs a graph with the properties specified in {@code builder}. */
StandardValueGraph(AbstractGraphBuilder<? super N> builder) {
this(
builder,
Reported by PMD.
Line: 54
final MapIteratorCache<N, GraphConnections<N, V>> nodeConnections;
long edgeCount; // must be updated when edges are added or removed
/** Constructs a graph with the properties specified in {@code builder}. */
StandardValueGraph(AbstractGraphBuilder<? super N> builder) {
this(
builder,
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java
18 issues
Line: 56
}
private abstract static class GeneralSpliterator<E> {
final Spliterator<E> spliterator;
GeneralSpliterator(Spliterator<E> spliterator) {
this.spliterator = checkNotNull(spliterator);
}
Reported by PMD.
Line: 118
* from creating the Spliterator.OfInt in the first place. So it's probably OK for us to suppress
* this particular violation.
*/
@SuppressWarnings("AndroidJdkLibsChecker")
private static final class GeneralSpliteratorOfPrimitive<E, C> extends GeneralSpliterator<E> {
final Spliterator.OfPrimitive<E, C, ?> spliterator;
final Function<Consumer<? super E>, C> consumerizer;
GeneralSpliteratorOfPrimitive(
Reported by PMD.
Line: 120
*/
@SuppressWarnings("AndroidJdkLibsChecker")
private static final class GeneralSpliteratorOfPrimitive<E, C> extends GeneralSpliterator<E> {
final Spliterator.OfPrimitive<E, C, ?> spliterator;
final Function<Consumer<? super E>, C> consumerizer;
GeneralSpliteratorOfPrimitive(
Spliterator.OfPrimitive<E, C, ?> spliterator,
Function<Consumer<? super E>, C> consumerizer) {
Reported by PMD.
Line: 121
@SuppressWarnings("AndroidJdkLibsChecker")
private static final class GeneralSpliteratorOfPrimitive<E, C> extends GeneralSpliterator<E> {
final Spliterator.OfPrimitive<E, C, ?> spliterator;
final Function<Consumer<? super E>, C> consumerizer;
GeneralSpliteratorOfPrimitive(
Spliterator.OfPrimitive<E, C, ?> spliterator,
Function<Consumer<? super E>, C> consumerizer) {
super(spliterator);
Reported by PMD.
Line: 162
NO_SPLIT_TRY_ADVANCE {
@Override
<E> void forEach(GeneralSpliterator<E> spliterator, Consumer<? super E> consumer) {
while (spliterator.tryAdvance(consumer)) {
// do nothing
}
}
},
MAXIMUM_SPLIT {
Reported by PMD.
Line: 214
spliterator.estimateSize(), originalSize));
}
if (trySplit != null) {
if (trySplit.estimateSize() > originalSize) {
fail(
format(
"estimated size of trySplit result (%s) is larger than original size (%s)",
trySplit.estimateSize(), originalSize));
}
Reported by PMD.
Line: 270
() -> new GeneralSpliteratorOfPrimitive<>(spliteratorSupplier.get(), c -> c::accept)));
}
private final ImmutableSet<Supplier<GeneralSpliterator<E>>> spliteratorSuppliers;
private SpliteratorTester(ImmutableSet<Supplier<GeneralSpliterator<E>>> spliteratorSuppliers) {
this.spliteratorSuppliers = checkNotNull(spliteratorSuppliers);
}
Reported by PMD.
Line: 285
List<List<E>> resultsForAllStrategies = new ArrayList<>();
for (Supplier<GeneralSpliterator<E>> spliteratorSupplier : spliteratorSuppliers) {
GeneralSpliterator<E> spliterator = spliteratorSupplier.get();
int characteristics = spliterator.characteristics();
long estimatedSize = spliterator.estimateSize();
for (SpliteratorDecompositionStrategy strategy :
EnumSet.allOf(SpliteratorDecompositionStrategy.class)) {
List<E> resultsForStrategy = new ArrayList<>();
strategy.forEach(spliteratorSupplier.get(), resultsForStrategy::add);
Reported by PMD.
Line: 286
for (Supplier<GeneralSpliterator<E>> spliteratorSupplier : spliteratorSuppliers) {
GeneralSpliterator<E> spliterator = spliteratorSupplier.get();
int characteristics = spliterator.characteristics();
long estimatedSize = spliterator.estimateSize();
for (SpliteratorDecompositionStrategy strategy :
EnumSet.allOf(SpliteratorDecompositionStrategy.class)) {
List<E> resultsForStrategy = new ArrayList<>();
strategy.forEach(spliteratorSupplier.get(), resultsForStrategy::add);
Reported by PMD.
Line: 289
long estimatedSize = spliterator.estimateSize();
for (SpliteratorDecompositionStrategy strategy :
EnumSet.allOf(SpliteratorDecompositionStrategy.class)) {
List<E> resultsForStrategy = new ArrayList<>();
strategy.forEach(spliteratorSupplier.get(), resultsForStrategy::add);
// TODO(cpovirk): better failure messages
if ((characteristics & Spliterator.NONNULL) != 0) {
assertFalse(resultsForStrategy.contains(null));
Reported by PMD.
android/guava/src/com/google/common/eventbus/Dispatcher.java
18 issues
Line: 79
// This dispatcher matches the original dispatch behavior of EventBus.
/** Per-thread queue of events to dispatch. */
private final ThreadLocal<Queue<Event>> queue =
new ThreadLocal<Queue<Event>>() {
@Override
protected Queue<Event> initialValue() {
return Queues.newArrayDeque();
}
Reported by PMD.
Line: 88
};
/** Per-thread dispatch state, used to avoid reentrant event dispatching. */
private final ThreadLocal<Boolean> dispatching =
new ThreadLocal<Boolean>() {
@Override
protected Boolean initialValue() {
return false;
}
Reported by PMD.
Line: 107
dispatching.set(true);
try {
Event nextEvent;
while ((nextEvent = queueForThread.poll()) != null) {
while (nextEvent.subscribers.hasNext()) {
nextEvent.subscribers.next().dispatchEvent(nextEvent.event);
}
}
} finally {
Reported by PMD.
Line: 108
try {
Event nextEvent;
while ((nextEvent = queueForThread.poll()) != null) {
while (nextEvent.subscribers.hasNext()) {
nextEvent.subscribers.next().dispatchEvent(nextEvent.event);
}
}
} finally {
dispatching.remove();
Reported by PMD.
Line: 109
Event nextEvent;
while ((nextEvent = queueForThread.poll()) != null) {
while (nextEvent.subscribers.hasNext()) {
nextEvent.subscribers.next().dispatchEvent(nextEvent.event);
}
}
} finally {
dispatching.remove();
queue.remove();
Reported by PMD.
Line: 109
Event nextEvent;
while ((nextEvent = queueForThread.poll()) != null) {
while (nextEvent.subscribers.hasNext()) {
nextEvent.subscribers.next().dispatchEvent(nextEvent.event);
}
}
} finally {
dispatching.remove();
queue.remove();
Reported by PMD.
Line: 120
}
private static final class Event {
private final Object event;
private final Iterator<Subscriber> subscribers;
private Event(Object event, Iterator<Subscriber> subscribers) {
this.event = event;
this.subscribers = subscribers;
Reported by PMD.
Line: 120
}
private static final class Event {
private final Object event;
private final Iterator<Subscriber> subscribers;
private Event(Object event, Iterator<Subscriber> subscribers) {
this.event = event;
this.subscribers = subscribers;
Reported by PMD.
Line: 121
private static final class Event {
private final Object event;
private final Iterator<Subscriber> subscribers;
private Event(Object event, Iterator<Subscriber> subscribers) {
this.event = event;
this.subscribers = subscribers;
}
Reported by PMD.
Line: 152
// in some cases.
/** Global event queue. */
private final ConcurrentLinkedQueue<EventWithSubscriber> queue =
Queues.newConcurrentLinkedQueue();
@Override
void dispatch(Object event, Iterator<Subscriber> subscribers) {
checkNotNull(event);
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java
18 issues
Line: 59
* In certain circumstances, this field might theoretically not be visible to an afterDone() call
* triggered by cancel(). For details, see the comments on the fields of TimeoutFuture.
*/
@CheckForNull ListenableFuture<? extends I> inputFuture;
@CheckForNull F function;
AbstractTransformFuture(ListenableFuture<? extends I> inputFuture, F function) {
this.inputFuture = checkNotNull(inputFuture);
this.function = checkNotNull(function);
Reported by PMD.
Line: 60
* triggered by cancel(). For details, see the comments on the fields of TimeoutFuture.
*/
@CheckForNull ListenableFuture<? extends I> inputFuture;
@CheckForNull F function;
AbstractTransformFuture(ListenableFuture<? extends I> inputFuture, F function) {
this.inputFuture = checkNotNull(inputFuture);
this.function = checkNotNull(function);
}
Reported by PMD.
Line: 68
}
@Override
public final void run() {
ListenableFuture<? extends I> localInputFuture = inputFuture;
F localFunction = function;
if (isCancelled() | localInputFuture == null | localFunction == null) {
return;
}
Reported by PMD.
Line: 74
if (isCancelled() | localInputFuture == null | localFunction == null) {
return;
}
inputFuture = null;
if (localInputFuture.isCancelled()) {
@SuppressWarnings("unchecked")
boolean unused =
setFuture((ListenableFuture<O>) localInputFuture); // Respects cancellation cause setting
Reported by PMD.
Line: 76
}
inputFuture = null;
if (localInputFuture.isCancelled()) {
@SuppressWarnings("unchecked")
boolean unused =
setFuture((ListenableFuture<O>) localInputFuture); // Respects cancellation cause setting
return;
}
Reported by PMD.
Line: 78
if (localInputFuture.isCancelled()) {
@SuppressWarnings("unchecked")
boolean unused =
setFuture((ListenableFuture<O>) localInputFuture); // Respects cancellation cause setting
return;
}
/*
Reported by PMD.
Line: 106
// Set the cause of the exception as this future's exception.
setException(e.getCause());
return;
} catch (RuntimeException e) {
// Bug in inputFuture.get(). Propagate to the output Future so that its consumers don't hang.
setException(e);
return;
} catch (Error e) {
/*
Reported by PMD.
Line: 123
T transformResult;
try {
transformResult = doTransform(localFunction, sourceResult);
} catch (Throwable t) {
// This exception is irrelevant in this thread, but useful for the client.
setException(t);
return;
} finally {
function = null;
Reported by PMD.
Line: 128
setException(t);
return;
} finally {
function = null;
}
/*
* If set()/setValue() throws an Error, we let it propagate. Why? The most likely Error is a
* StackOverflowError (from deep transform(..., directExecutor()) nesting), and calling
Reported by PMD.
Line: 173
/** Template method for subtypes to actually run the transform. */
@ForOverride
@ParametricNullness
abstract T doTransform(F function, @ParametricNullness I result) throws Exception;
/** Template method for subtypes to actually set the result. */
@ForOverride
abstract void setResult(@ParametricNullness T result);
Reported by PMD.
android/guava/src/com/google/common/graph/ForwardingValueGraph.java
18 issues
Line: 30
* @author Joshua O'Madadhain
*/
@ElementTypesAreNonnullByDefault
abstract class ForwardingValueGraph<N, V> extends AbstractValueGraph<N, V> {
abstract ValueGraph<N, V> delegate();
@Override
public Set<N> nodes() {
Reported by PMD.
Line: 36
@Override
public Set<N> nodes() {
return delegate().nodes();
}
/**
* Defer to {@link AbstractValueGraph#edges()} (based on {@link #successors(Object)}) for full
* edges() implementation.
Reported by PMD.
Line: 45
*/
@Override
protected long edgeCount() {
return delegate().edges().size();
}
@Override
public boolean isDirected() {
return delegate().isDirected();
Reported by PMD.
Line: 45
*/
@Override
protected long edgeCount() {
return delegate().edges().size();
}
@Override
public boolean isDirected() {
return delegate().isDirected();
Reported by PMD.
Line: 50
@Override
public boolean isDirected() {
return delegate().isDirected();
}
@Override
public boolean allowsSelfLoops() {
return delegate().allowsSelfLoops();
Reported by PMD.
Line: 55
@Override
public boolean allowsSelfLoops() {
return delegate().allowsSelfLoops();
}
@Override
public ElementOrder<N> nodeOrder() {
return delegate().nodeOrder();
Reported by PMD.
Line: 60
@Override
public ElementOrder<N> nodeOrder() {
return delegate().nodeOrder();
}
@Override
public ElementOrder<N> incidentEdgeOrder() {
return delegate().incidentEdgeOrder();
Reported by PMD.
Line: 65
@Override
public ElementOrder<N> incidentEdgeOrder() {
return delegate().incidentEdgeOrder();
}
@Override
public Set<N> adjacentNodes(N node) {
return delegate().adjacentNodes(node);
Reported by PMD.
Line: 70
@Override
public Set<N> adjacentNodes(N node) {
return delegate().adjacentNodes(node);
}
@Override
public Set<N> predecessors(N node) {
return delegate().predecessors(node);
Reported by PMD.
Line: 75
@Override
public Set<N> predecessors(N node) {
return delegate().predecessors(node);
}
@Override
public Set<N> successors(N node) {
return delegate().successors(node);
Reported by PMD.
android/guava/src/com/google/common/collect/ForwardingDeque.java
18 issues
Line: 46
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class ForwardingDeque<E extends @Nullable Object> extends ForwardingQueue<E>
implements Deque<E> {
/** Constructor for use by subclasses. */
protected ForwardingDeque() {}
@Override
Reported by PMD.
Line: 56
@Override
public void addFirst(@ParametricNullness E e) {
delegate().addFirst(e);
}
@Override
public void addLast(@ParametricNullness E e) {
delegate().addLast(e);
Reported by PMD.
Line: 61
@Override
public void addLast(@ParametricNullness E e) {
delegate().addLast(e);
}
@Override
public Iterator<E> descendingIterator() {
return delegate().descendingIterator();
Reported by PMD.
Line: 66
@Override
public Iterator<E> descendingIterator() {
return delegate().descendingIterator();
}
@Override
@ParametricNullness
public E getFirst() {
Reported by PMD.
Line: 72
@Override
@ParametricNullness
public E getFirst() {
return delegate().getFirst();
}
@Override
@ParametricNullness
public E getLast() {
Reported by PMD.
Line: 78
@Override
@ParametricNullness
public E getLast() {
return delegate().getLast();
}
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
@Override
public boolean offerFirst(@ParametricNullness E e) {
Reported by PMD.
Line: 84
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
@Override
public boolean offerFirst(@ParametricNullness E e) {
return delegate().offerFirst(e);
}
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
@Override
public boolean offerLast(@ParametricNullness E e) {
Reported by PMD.
Line: 90
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
@Override
public boolean offerLast(@ParametricNullness E e) {
return delegate().offerLast(e);
}
@Override
@CheckForNull
public E peekFirst() {
Reported by PMD.
Line: 96
@Override
@CheckForNull
public E peekFirst() {
return delegate().peekFirst();
}
@Override
@CheckForNull
public E peekLast() {
Reported by PMD.
Line: 102
@Override
@CheckForNull
public E peekLast() {
return delegate().peekLast();
}
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
@Override
@CheckForNull
Reported by PMD.
android/guava/src/com/google/common/graph/AbstractBaseGraph.java
18 issues
Line: 95
}
EndpointPair<?> endpointPair = (EndpointPair<?>) obj;
return isOrderingCompatible(endpointPair)
&& nodes().contains(endpointPair.nodeU())
&& successors((N) endpointPair.nodeU()).contains(endpointPair.nodeV());
}
};
}
Reported by PMD.
Line: 95
}
EndpointPair<?> endpointPair = (EndpointPair<?>) obj;
return isOrderingCompatible(endpointPair)
&& nodes().contains(endpointPair.nodeU())
&& successors((N) endpointPair.nodeU()).contains(endpointPair.nodeV());
}
};
}
Reported by PMD.
Line: 96
EndpointPair<?> endpointPair = (EndpointPair<?>) obj;
return isOrderingCompatible(endpointPair)
&& nodes().contains(endpointPair.nodeU())
&& successors((N) endpointPair.nodeU()).contains(endpointPair.nodeV());
}
};
}
@Override
Reported by PMD.
Line: 96
EndpointPair<?> endpointPair = (EndpointPair<?>) obj;
return isOrderingCompatible(endpointPair)
&& nodes().contains(endpointPair.nodeU())
&& successors((N) endpointPair.nodeU()).contains(endpointPair.nodeV());
}
};
}
@Override
Reported by PMD.
Line: 109
@Override
public Set<EndpointPair<N>> incidentEdges(N node) {
checkNotNull(node);
checkArgument(nodes().contains(node), "Node %s is not an element of this graph.", node);
return new IncidentEdgeSet<N>(this, node) {
@Override
public UnmodifiableIterator<EndpointPair<N>> iterator() {
if (graph.isDirected()) {
return Iterators.unmodifiableIterator(
Reported by PMD.
Line: 117
return Iterators.unmodifiableIterator(
Iterators.concat(
Iterators.transform(
graph.predecessors(node).iterator(),
new Function<N, EndpointPair<N>>() {
@Override
public EndpointPair<N> apply(N predecessor) {
return EndpointPair.ordered(predecessor, node);
}
Reported by PMD.
Line: 126
}),
Iterators.transform(
// filter out 'node' from successors (already covered by predecessors, above)
Sets.difference(graph.successors(node), ImmutableSet.of(node)).iterator(),
new Function<N, EndpointPair<N>>() {
@Override
public EndpointPair<N> apply(N successor) {
return EndpointPair.ordered(node, successor);
}
Reported by PMD.
Line: 136
} else {
return Iterators.unmodifiableIterator(
Iterators.transform(
graph.adjacentNodes(node).iterator(),
new Function<N, EndpointPair<N>>() {
@Override
public EndpointPair<N> apply(N adjacentNode) {
return EndpointPair.unordered(node, adjacentNode);
}
Reported by PMD.
Line: 151
@Override
public int degree(N node) {
if (isDirected()) {
return IntMath.saturatedAdd(predecessors(node).size(), successors(node).size());
} else {
Set<N> neighbors = adjacentNodes(node);
int selfLoopCount = (allowsSelfLoops() && neighbors.contains(node)) ? 1 : 0;
return IntMath.saturatedAdd(neighbors.size(), selfLoopCount);
}
Reported by PMD.
Line: 151
@Override
public int degree(N node) {
if (isDirected()) {
return IntMath.saturatedAdd(predecessors(node).size(), successors(node).size());
} else {
Set<N> neighbors = adjacentNodes(node);
int selfLoopCount = (allowsSelfLoops() && neighbors.contains(node)) ? 1 : 0;
return IntMath.saturatedAdd(neighbors.size(), selfLoopCount);
}
Reported by PMD.