The following issues were found
guava/src/com/google/common/collect/ComparisonChain.java
3 issues
Line: 61
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class ComparisonChain {
private ComparisonChain() {}
/** Begins a new chained comparison statement. See example in the class documentation. */
public static ComparisonChain start() {
return ACTIVE;
Reported by PMD.
Line: 128
private static final ComparisonChain GREATER = new InactiveComparisonChain(1);
private static final class InactiveComparisonChain extends ComparisonChain {
final int result;
InactiveComparisonChain(int result) {
this.result = result;
}
Reported by PMD.
Line: 128
private static final ComparisonChain GREATER = new InactiveComparisonChain(1);
private static final class InactiveComparisonChain extends ComparisonChain {
final int result;
InactiveComparisonChain(int result) {
this.result = result;
}
Reported by PMD.
guava/src/com/google/common/io/CountingInputStream.java
3 issues
Line: 36
@ElementTypesAreNonnullByDefault
public final class CountingInputStream extends FilterInputStream {
private long count;
private long mark = -1;
/**
* Wraps another input stream, counting the number of bytes read.
*
Reported by PMD.
Line: 37
public final class CountingInputStream extends FilterInputStream {
private long count;
private long mark = -1;
/**
* Wraps another input stream, counting the number of bytes read.
*
* @param in the input stream to be wrapped
Reported by PMD.
Line: 37
public final class CountingInputStream extends FilterInputStream {
private long count;
private long mark = -1;
/**
* Wraps another input stream, counting the number of bytes read.
*
* @param in the input stream to be wrapped
Reported by PMD.
guava/src/com/google/common/collect/CollectPreconditions.java
3 issues
Line: 31
static void checkEntryNotNull(Object key, Object value) {
if (key == null) {
throw new NullPointerException("null key in entry: null=" + value);
} else if (value == null) {
throw new NullPointerException("null value in entry: " + key + "=null");
}
}
Reported by PMD.
Line: 33
if (key == null) {
throw new NullPointerException("null key in entry: null=" + value);
} else if (value == null) {
throw new NullPointerException("null value in entry: " + key + "=null");
}
}
@CanIgnoreReturnValue
static int checkNonnegative(int value, String name) {
Reported by PMD.
Line: 27
/** Precondition checks useful in collection implementations. */
@GwtCompatible
@ElementTypesAreNonnullByDefault
final class CollectPreconditions {
static void checkEntryNotNull(Object key, Object value) {
if (key == null) {
throw new NullPointerException("null key in entry: null=" + value);
} else if (value == null) {
Reported by PMD.
guava/src/com/google/common/collect/AbstractSetMultimap.java
3 issues
Line: 125
* values.
*/
@Override
public Map<K, Collection<V>> asMap() {
return super.asMap();
}
/**
* Stores a key-value pair in the multimap.
Reported by PMD.
Line: 150
* Equality does not depend on the ordering of keys or values.
*/
@Override
public boolean equals(@CheckForNull Object object) {
return super.equals(object);
}
private static final long serialVersionUID = 7431625294878419160L;
}
Reported by PMD.
Line: 150
* Equality does not depend on the ordering of keys or values.
*/
@Override
public boolean equals(@CheckForNull Object object) {
return super.equals(object);
}
private static final long serialVersionUID = 7431625294878419160L;
}
Reported by PMD.
guava/src/com/google/common/math/MathPreconditions.java
3 issues
Line: 30
@GwtCompatible
@CanIgnoreReturnValue
@ElementTypesAreNonnullByDefault
final class MathPreconditions {
static int checkPositive(String role, int x) {
if (x <= 0) {
throw new IllegalArgumentException(role + " (" + x + ") must be > 0");
}
return x;
Reported by PMD.
Line: 54
static int checkNonNegative(String role, int x) {
if (x < 0) {
throw new IllegalArgumentException(role + " (" + x + ") must be >= 0");
}
return x;
}
static long checkNonNegative(String role, long x) {
Reported by PMD.
Line: 74
}
static double checkNonNegative(String role, double x) {
if (!(x >= 0)) { // not x < 0, to work with NaN.
throw new IllegalArgumentException(role + " (" + x + ") must be >= 0");
}
return x;
}
Reported by PMD.
guava/src/com/google/common/collect/AbstractListMultimap.java
3 issues
Line: 128
* values.
*/
@Override
public Map<K, Collection<V>> asMap() {
return super.asMap();
}
/**
* Compares the specified object to this multimap for equality.
Reported by PMD.
Line: 139
* in the same order. If the value orderings disagree, the multimaps will not be considered equal.
*/
@Override
public boolean equals(@CheckForNull Object object) {
return super.equals(object);
}
private static final long serialVersionUID = 6588350623831699109L;
}
Reported by PMD.
Line: 139
* in the same order. If the value orderings disagree, the multimaps will not be considered equal.
*/
@Override
public boolean equals(@CheckForNull Object object) {
return super.equals(object);
}
private static final long serialVersionUID = 6588350623831699109L;
}
Reported by PMD.
guava/src/com/google/common/cache/LongAddables.java
3 issues
Line: 28
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
final class LongAddables {
private static final Supplier<LongAddable> SUPPLIER;
static {
Supplier<LongAddable> supplier;
try {
Reported by PMD.
Line: 42
return new LongAdder();
}
};
} catch (Throwable t) { // we really want to catch *everything*
supplier =
new Supplier<LongAddable>() {
@Override
public LongAddable get() {
return new PureJavaLongAddable();
Reported by PMD.
Line: 58
return SUPPLIER.get();
}
private static final class PureJavaLongAddable extends AtomicLong implements LongAddable {
@Override
public void increment() {
getAndIncrement();
}
Reported by PMD.
guava/src/com/google/common/primitives/UnsignedInts.java
3 issues
Line: 51
@Beta
@GwtCompatible
@ElementTypesAreNonnullByDefault
public final class UnsignedInts {
static final long INT_MASK = 0xffffffffL;
private UnsignedInts() {}
static int flip(int value) {
Reported by PMD.
Line: 220
*
* @since 23.1
*/
public static void sort(int[] array) {
checkNotNull(array);
sort(array, 0, array.length);
}
/**
Reported by PMD.
Line: 249
*
* @since 23.1
*/
public static void sortDescending(int[] array) {
checkNotNull(array);
sortDescending(array, 0, array.length);
}
/**
Reported by PMD.
guava/src/com/google/common/base/JdkPattern.java
3 issues
Line: 26
@ElementTypesAreNonnullByDefault
@GwtIncompatible
final class JdkPattern extends CommonPattern implements Serializable {
private final Pattern pattern;
JdkPattern(Pattern pattern) {
this.pattern = Preconditions.checkNotNull(pattern);
}
Reported by PMD.
Line: 26
@ElementTypesAreNonnullByDefault
@GwtIncompatible
final class JdkPattern extends CommonPattern implements Serializable {
private final Pattern pattern;
JdkPattern(Pattern pattern) {
this.pattern = Preconditions.checkNotNull(pattern);
}
Reported by PMD.
Line: 53
}
private static final class JdkMatcher extends CommonMatcher {
final Matcher matcher;
JdkMatcher(Matcher matcher) {
this.matcher = Preconditions.checkNotNull(matcher);
}
Reported by PMD.
guava/src/com/google/common/util/concurrent/CollectionFuture.java
3 issues
Line: 39
* there: cancel() never reads this field, only writes to it. That makes the race here completely
* harmless, rather than just 99.99% harmless.
*/
@CheckForNull private List<@Nullable Present<V>> values;
CollectionFuture(
ImmutableCollection<? extends ListenableFuture<? extends V>> futures,
boolean allMustSucceed) {
super(futures, allMustSucceed, true);
Reported by PMD.
Line: 78
@Override
void releaseResources(ReleaseResourcesReason reason) {
super.releaseResources(reason);
this.values = null;
}
abstract C combine(List<@Nullable Present<V>> values);
/** Used for {@link Futures#allAsList} and {@link Futures#successfulAsList}. */
Reported by PMD.
Line: 105
/** The result of a successful {@code Future}. */
private static final class Present<V extends @Nullable Object> {
V value;
Present(V value) {
this.value = value;
}
}
Reported by PMD.