The following issues were found
android/guava/src/com/google/common/primitives/ParseRequest.java
4 issues
Line: 23
@GwtCompatible
@ElementTypesAreNonnullByDefault
final class ParseRequest {
final String rawValue;
final int radix;
private ParseRequest(String rawValue, int radix) {
this.rawValue = rawValue;
this.radix = radix;
Reported by PMD.
Line: 24
@ElementTypesAreNonnullByDefault
final class ParseRequest {
final String rawValue;
final int radix;
private ParseRequest(String rawValue, int radix) {
this.rawValue = rawValue;
this.radix = radix;
}
Reported by PMD.
Line: 43
if (stringValue.startsWith("0x") || stringValue.startsWith("0X")) {
rawValue = stringValue.substring(2);
radix = 16;
} else if (firstChar == '#') {
rawValue = stringValue.substring(1);
radix = 16;
} else if (firstChar == '0' && stringValue.length() > 1) {
rawValue = stringValue.substring(1);
radix = 8;
Reported by PMD.
Line: 39
// Handle radix specifier if present
String rawValue;
int radix;
char firstChar = stringValue.charAt(0);
if (stringValue.startsWith("0x") || stringValue.startsWith("0X")) {
rawValue = stringValue.substring(2);
radix = 16;
} else if (firstChar == '#') {
rawValue = stringValue.substring(1);
Reported by PMD.
android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java
4 issues
Line: 40
* @since 13.0
*/
@Beta
public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B>
implements TypeToInstanceMap<B> {
private final Map<TypeToken<? extends B>, B> backingMap = Maps.newHashMap();
@Override
Reported by PMD.
Line: 43
public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B>
implements TypeToInstanceMap<B> {
private final Map<TypeToken<? extends B>, B> backingMap = Maps.newHashMap();
@Override
@NullableDecl
public <T extends B> T getInstance(Class<T> type) {
return trustedGet(TypeToken.of(type));
Reported by PMD.
Line: 122
private static final class UnmodifiableEntry<K, V> extends ForwardingMapEntry<K, V> {
private final Entry<K, V> delegate;
static <K, V> Set<Entry<K, V>> transformEntries(final Set<Entry<K, V>> entries) {
return new ForwardingSet<Map.Entry<K, V>>() {
@Override
protected Set<Entry<K, V>> delegate() {
Reported by PMD.
Line: 122
private static final class UnmodifiableEntry<K, V> extends ForwardingMapEntry<K, V> {
private final Entry<K, V> delegate;
static <K, V> Set<Entry<K, V>> transformEntries(final Set<Entry<K, V>> entries) {
return new ForwardingSet<Map.Entry<K, V>>() {
@Override
protected Set<Entry<K, V>> delegate() {
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java
4 issues
Line: 258
for (int i = 0; i < length; i++) {
builder.add(doubleToRawLongBits(s.readDouble()));
}
this.longs = new AtomicLongArray(builder.build().toArray());
}
}
Reported by PMD.
Line: 71
* @param array the array to copy elements from
* @throws NullPointerException if array is null
*/
public AtomicDoubleArray(double[] array) {
final int len = array.length;
long[] longArray = new long[len];
for (int i = 0; i < len; i++) {
longArray[i] = doubleToRawLongBits(array[i]);
}
Reported by PMD.
Line: 220
// Double.toString(Math.PI).length() == 17
StringBuilder b = new StringBuilder((17 + 2) * (iMax + 1));
b.append('[');
for (int i = 0; ; i++) {
b.append(longBitsToDouble(longs.get(i)));
if (i == iMax) {
return b.append(']').toString();
}
b.append(',').append(' ');
Reported by PMD.
Line: 220
// Double.toString(Math.PI).length() == 17
StringBuilder b = new StringBuilder((17 + 2) * (iMax + 1));
b.append('[');
for (int i = 0; ; i++) {
b.append(longBitsToDouble(longs.get(i)));
if (i == iMax) {
return b.append(']').toString();
}
b.append(',').append(' ');
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/Callables.java
4 issues
Line: 89
@ParametricNullness
public T call() throws Exception {
Thread currentThread = Thread.currentThread();
String oldName = currentThread.getName();
boolean restoreName = trySetName(nameSupplier.get(), currentThread);
try {
return callable.call();
} finally {
if (restoreName) {
Reported by PMD.
Line: 95
return callable.call();
} finally {
if (restoreName) {
boolean unused = trySetName(oldName, currentThread);
}
}
}
};
}
Reported by PMD.
Line: 118
@Override
public void run() {
Thread currentThread = Thread.currentThread();
String oldName = currentThread.getName();
boolean restoreName = trySetName(nameSupplier.get(), currentThread);
try {
task.run();
} finally {
if (restoreName) {
Reported by PMD.
Line: 124
task.run();
} finally {
if (restoreName) {
boolean unused = trySetName(oldName, currentThread);
}
}
}
};
}
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java
4 issues
Line: 74
} catch (Throwable errorInLogging) {
// If logging fails, e.g. due to missing memory, at least try to log the
// message and the cause for the failed logging.
System.err.println(e.getMessage());
System.err.println(errorInLogging.getMessage());
} finally {
runtime.exit(1);
}
}
Reported by PMD.
Line: 75
// If logging fails, e.g. due to missing memory, at least try to log the
// message and the cause for the failed logging.
System.err.println(e.getMessage());
System.err.println(errorInLogging.getMessage());
} finally {
runtime.exit(1);
}
}
}
Reported by PMD.
Line: 60
static final class Exiter implements UncaughtExceptionHandler {
private static final Logger logger = Logger.getLogger(Exiter.class.getName());
private final Runtime runtime;
Exiter(Runtime runtime) {
this.runtime = runtime;
}
Reported by PMD.
Line: 71
try {
logger.log(
SEVERE, String.format(Locale.ROOT, "Caught an exception in %s. Shutting down.", t), e);
} catch (Throwable errorInLogging) {
// If logging fails, e.g. due to missing memory, at least try to log the
// message and the cause for the failed logging.
System.err.println(e.getMessage());
System.err.println(errorInLogging.getMessage());
} finally {
Reported by PMD.
guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/LongAdder.java
4 issues
Line: 26
*/
class LongAdder implements LongAddable {
private long value;
public void increment() {
value++;
}
Reported by PMD.
Line: 28
private long value;
public void increment() {
value++;
}
public void add(long x) {
value += x;
Reported by PMD.
Line: 32
value++;
}
public void add(long x) {
value += x;
}
public long sum() {
return value;
Reported by PMD.
Line: 36
value += x;
}
public long sum() {
return value;
}
}
Reported by PMD.
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSortedSet.java
4 issues
Line: 27
*
* @author Hayward Chan
*/
final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
/** true if this set is a subset of another immutable sorted set. */
final boolean isSubset;
private Comparator<E> unusedComparatorForSerialization;
Reported by PMD.
Line: 30
final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
/** true if this set is a subset of another immutable sorted set. */
final boolean isSubset;
private Comparator<E> unusedComparatorForSerialization;
private E unusedElementForSerialization;
RegularImmutableSortedSet(SortedSet<E> delegate, boolean isSubset) {
Reported by PMD.
Line: 32
/** true if this set is a subset of another immutable sorted set. */
final boolean isSubset;
private Comparator<E> unusedComparatorForSerialization;
private E unusedElementForSerialization;
RegularImmutableSortedSet(SortedSet<E> delegate, boolean isSubset) {
super(delegate);
this.isSubset = isSubset;
Reported by PMD.
Line: 33
final boolean isSubset;
private Comparator<E> unusedComparatorForSerialization;
private E unusedElementForSerialization;
RegularImmutableSortedSet(SortedSet<E> delegate, boolean isSubset) {
super(delegate);
this.isSubset = isSubset;
}
Reported by PMD.
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableBiMap.java
4 issues
Line: 28
*
* @author Hayward Chan
*/
final class SingletonImmutableBiMap<K, V> extends ImmutableBiMap<K, V> {
// These references are used both by the custom field serializer, and by the
// GWT compiler to infer the keys and values of the map that needs to be
// serialized.
//
Reported by PMD.
Line: 36
//
// Although they are non-final, they are package private and the reference is
// never modified after a map is constructed.
K singleKey;
V singleValue;
transient SingletonImmutableBiMap<V, K> inverse;
SingletonImmutableBiMap(K key, V value) {
Reported by PMD.
Line: 37
// Although they are non-final, they are package private and the reference is
// never modified after a map is constructed.
K singleKey;
V singleValue;
transient SingletonImmutableBiMap<V, K> inverse;
SingletonImmutableBiMap(K key, V value) {
super(Collections.singletonMap(checkNotNull(key), checkNotNull(value)));
Reported by PMD.
Line: 39
K singleKey;
V singleValue;
transient SingletonImmutableBiMap<V, K> inverse;
SingletonImmutableBiMap(K key, V value) {
super(Collections.singletonMap(checkNotNull(key), checkNotNull(value)));
this.singleKey = key;
this.singleValue = value;
Reported by PMD.
guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AggregateFutureState.java
4 issues
Line: 27
abstract class AggregateFutureState<OutputT> extends AbstractFuture.TrustedFuture<OutputT> {
// Lazily initialized the first time we see an exception; not released until all the input futures
// & this future completes. Released when the future releases the reference to the running state
private Set<Throwable> seenExceptions = null;
private int remaining;
AggregateFutureState(int remainingFutures) {
this.remaining = remainingFutures;
}
Reported by PMD.
Line: 27
abstract class AggregateFutureState<OutputT> extends AbstractFuture.TrustedFuture<OutputT> {
// Lazily initialized the first time we see an exception; not released until all the input futures
// & this future completes. Released when the future releases the reference to the running state
private Set<Throwable> seenExceptions = null;
private int remaining;
AggregateFutureState(int remainingFutures) {
this.remaining = remainingFutures;
}
Reported by PMD.
Line: 28
// Lazily initialized the first time we see an exception; not released until all the input futures
// & this future completes. Released when the future releases the reference to the running state
private Set<Throwable> seenExceptions = null;
private int remaining;
AggregateFutureState(int remainingFutures) {
this.remaining = remainingFutures;
}
Reported by PMD.
Line: 49
}
final void clearSeenExceptions() {
seenExceptions = null;
}
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java
4 issues
Line: 54
/** Returns an iterable whose iterator returns the given elements in order. */
public static <E> MinimalIterable<E> of(E... elements) {
// Make sure to get an unmodifiable iterator
return new MinimalIterable<E>(Arrays.asList(elements).iterator());
}
/**
* Returns an iterable whose iterator returns the given elements in order. The elements are copied
* out of the source collection at the time this method is called.
Reported by PMD.
Line: 66
return (MinimalIterable) of(elements.toArray());
}
private Iterator<E> iterator;
private MinimalIterable(Iterator<E> iterator) {
this.iterator = iterator;
}
Reported by PMD.
Line: 66
return (MinimalIterable) of(elements.toArray());
}
private Iterator<E> iterator;
private MinimalIterable(Iterator<E> iterator) {
this.iterator = iterator;
}
Reported by PMD.
Line: 82
try {
return iterator;
} finally {
iterator = null;
}
}
}
Reported by PMD.