The following issues were found
guava/src/com/google/common/collect/LinkedListMultimap.java
66 issues
Line: 340
previous = tail;
nextIndex = size;
while (index++ < size) {
previous();
}
} else {
next = head;
while (index-- > 0) {
next();
Reported by PMD.
Line: 345
} else {
next = head;
while (index-- > 0) {
next();
}
}
current = null;
}
Reported by PMD.
Line: 511
previous = (keyList == null) ? null : keyList.tail;
nextIndex = size;
while (index++ < size) {
previous();
}
} else {
next = (keyList == null) ? null : keyList.head;
while (index-- > 0) {
next();
Reported by PMD.
Line: 516
} else {
next = (keyList == null) ? null : keyList.head;
while (index-- > 0) {
next();
}
}
this.key = key;
current = null;
}
Reported by PMD.
Line: 333
@CheckForNull Node<K, V> previous;
int expectedModCount = modCount;
NodeIterator(int index) {
int size = size();
checkPositionIndex(index, size);
if (index >= (size / 2)) {
previous = tail;
nextIndex = size;
Reported by PMD.
Line: 333
@CheckForNull Node<K, V> previous;
int expectedModCount = modCount;
NodeIterator(int index) {
int size = size();
checkPositionIndex(index, size);
if (index >= (size / 2)) {
previous = tail;
nextIndex = size;
Reported by PMD.
Line: 503
*
* @throws IndexOutOfBoundsException if index is invalid
*/
public ValueForKeyIterator(@ParametricNullness K key, int index) {
KeyList<K, V> keyList = keyToKeyList.get(key);
int size = (keyList == null) ? 0 : keyList.count;
checkPositionIndex(index, size);
if (index >= (size / 2)) {
previous = (keyList == null) ? null : keyList.tail;
Reported by PMD.
Line: 503
*
* @throws IndexOutOfBoundsException if index is invalid
*/
public ValueForKeyIterator(@ParametricNullness K key, int index) {
KeyList<K, V> keyList = keyToKeyList.get(key);
int size = (keyList == null) ? 0 : keyList.count;
checkPositionIndex(index, size);
if (index >= (size / 2)) {
previous = (keyList == null) ? null : keyList.tail;
Reported by PMD.
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.Preconditions.checkPositionIndex;
import static com.google.common.base.Preconditions.checkState;
import static java.util.Collections.unmodifiableList;
Reported by PMD.
Line: 101
*/
@GwtCompatible(serializable = true, emulated = true)
@ElementTypesAreNonnullByDefault
public class LinkedListMultimap<K extends @Nullable Object, V extends @Nullable Object>
extends AbstractMultimap<K, V> implements ListMultimap<K, V>, Serializable {
/*
* Order is maintained using a linked list containing all key-value pairs. In
* addition, a series of disjoint linked lists of "siblings", each containing
* the values for a specific key, is used to implement {@link
Reported by PMD.
guava/src/com/google/common/cache/Striped64.java
66 issues
Line: 120
Class<?> ak = Cell.class;
valueOffset = UNSAFE.objectFieldOffset(ak.getDeclaredField("value"));
} catch (Exception e) {
throw new Error(e);
}
}
}
/**
Reported by PMD.
Line: 280
baseOffset = UNSAFE.objectFieldOffset(sk.getDeclaredField("base"));
busyOffset = UNSAFE.objectFieldOffset(sk.getDeclaredField("busy"));
} catch (Exception e) {
throw new Error(e);
}
}
/**
* Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. Replace with a simple call
Reported by PMD.
Line: 310
}
});
} catch (java.security.PrivilegedActionException e) {
throw new RuntimeException("Could not initialize intrinsics", e.getCause());
}
}
}
Reported by PMD.
Line: 182
* @param hc the hash code holder
* @param wasUncontended false if CAS failed before call
*/
final void retryUpdate(long x, @CheckForNull int[] hc, boolean wasUncontended) {
int h;
if (hc == null) {
threadHashCode.set(hc = new int[1]); // Initialize randomly
int r = rng.nextInt(); // Avoid zero to allow xorShift rehash
h = hc[0] = (r == 0) ? 1 : r;
Reported by PMD.
Line: 182
* @param hc the hash code holder
* @param wasUncontended false if CAS failed before call
*/
final void retryUpdate(long x, @CheckForNull int[] hc, boolean wasUncontended) {
int h;
if (hc == null) {
threadHashCode.set(hc = new int[1]); // Initialize randomly
int r = rng.nextInt(); // Avoid zero to allow xorShift rehash
h = hc[0] = (r == 0) ? 1 : r;
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 99
*/
static final class Cell {
volatile long p0, p1, p2, p3, p4, p5, p6;
volatile long value;
volatile long q0, q1, q2, q3, q4, q5, q6;
Cell(long x) {
value = x;
}
Reported by PMD.
Line: 119
UNSAFE = getUnsafe();
Class<?> ak = Cell.class;
valueOffset = UNSAFE.objectFieldOffset(ak.getDeclaredField("value"));
} catch (Exception e) {
throw new Error(e);
}
}
}
Reported by PMD.
android/guava/src/com/google/common/hash/Striped64.java
66 issues
Line: 120
Class<?> ak = Cell.class;
valueOffset = UNSAFE.objectFieldOffset(ak.getDeclaredField("value"));
} catch (Exception e) {
throw new Error(e);
}
}
}
/**
Reported by PMD.
Line: 280
baseOffset = UNSAFE.objectFieldOffset(sk.getDeclaredField("base"));
busyOffset = UNSAFE.objectFieldOffset(sk.getDeclaredField("busy"));
} catch (Exception e) {
throw new Error(e);
}
}
/**
* Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. Replace with a simple call
Reported by PMD.
Line: 310
}
});
} catch (java.security.PrivilegedActionException e) {
throw new RuntimeException("Could not initialize intrinsics", e.getCause());
}
}
}
Reported by PMD.
Line: 182
* @param hc the hash code holder
* @param wasUncontended false if CAS failed before call
*/
final void retryUpdate(long x, @CheckForNull int[] hc, boolean wasUncontended) {
int h;
if (hc == null) {
threadHashCode.set(hc = new int[1]); // Initialize randomly
int r = rng.nextInt(); // Avoid zero to allow xorShift rehash
h = hc[0] = (r == 0) ? 1 : r;
Reported by PMD.
Line: 182
* @param hc the hash code holder
* @param wasUncontended false if CAS failed before call
*/
final void retryUpdate(long x, @CheckForNull int[] hc, boolean wasUncontended) {
int h;
if (hc == null) {
threadHashCode.set(hc = new int[1]); // Initialize randomly
int r = rng.nextInt(); // Avoid zero to allow xorShift rehash
h = hc[0] = (r == 0) ? 1 : r;
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 99
*/
static final class Cell {
volatile long p0, p1, p2, p3, p4, p5, p6;
volatile long value;
volatile long q0, q1, q2, q3, q4, q5, q6;
Cell(long x) {
value = x;
}
Reported by PMD.
Line: 119
UNSAFE = getUnsafe();
Class<?> ak = Cell.class;
valueOffset = UNSAFE.objectFieldOffset(ak.getDeclaredField("value"));
} catch (Exception e) {
throw new Error(e);
}
}
}
Reported by PMD.
android/guava/src/com/google/common/collect/LinkedListMultimap.java
66 issues
Line: 338
previous = tail;
nextIndex = size;
while (index++ < size) {
previous();
}
} else {
next = head;
while (index-- > 0) {
next();
Reported by PMD.
Line: 343
} else {
next = head;
while (index-- > 0) {
next();
}
}
current = null;
}
Reported by PMD.
Line: 509
previous = (keyList == null) ? null : keyList.tail;
nextIndex = size;
while (index++ < size) {
previous();
}
} else {
next = (keyList == null) ? null : keyList.head;
while (index-- > 0) {
next();
Reported by PMD.
Line: 514
} else {
next = (keyList == null) ? null : keyList.head;
while (index-- > 0) {
next();
}
}
this.key = key;
current = null;
}
Reported by PMD.
Line: 331
@CheckForNull Node<K, V> previous;
int expectedModCount = modCount;
NodeIterator(int index) {
int size = size();
checkPositionIndex(index, size);
if (index >= (size / 2)) {
previous = tail;
nextIndex = size;
Reported by PMD.
Line: 331
@CheckForNull Node<K, V> previous;
int expectedModCount = modCount;
NodeIterator(int index) {
int size = size();
checkPositionIndex(index, size);
if (index >= (size / 2)) {
previous = tail;
nextIndex = size;
Reported by PMD.
Line: 501
*
* @throws IndexOutOfBoundsException if index is invalid
*/
public ValueForKeyIterator(@ParametricNullness K key, int index) {
KeyList<K, V> keyList = keyToKeyList.get(key);
int size = (keyList == null) ? 0 : keyList.count;
checkPositionIndex(index, size);
if (index >= (size / 2)) {
previous = (keyList == null) ? null : keyList.tail;
Reported by PMD.
Line: 501
*
* @throws IndexOutOfBoundsException if index is invalid
*/
public ValueForKeyIterator(@ParametricNullness K key, int index) {
KeyList<K, V> keyList = keyToKeyList.get(key);
int size = (keyList == null) ? 0 : keyList.count;
checkPositionIndex(index, size);
if (index >= (size / 2)) {
previous = (keyList == null) ? null : keyList.tail;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkPositionIndex;
import static com.google.common.base.Preconditions.checkState;
import static java.util.Collections.unmodifiableList;
import static java.util.Objects.requireNonNull;
Reported by PMD.
Line: 99
*/
@GwtCompatible(serializable = true, emulated = true)
@ElementTypesAreNonnullByDefault
public class LinkedListMultimap<K extends @Nullable Object, V extends @Nullable Object>
extends AbstractMultimap<K, V> implements ListMultimap<K, V>, Serializable {
/*
* Order is maintained using a linked list containing all key-value pairs. In
* addition, a series of disjoint linked lists of "siblings", each containing
* the values for a specific key, is used to implement {@link
Reported by PMD.
guava/src/com/google/common/hash/Striped64.java
66 issues
Line: 120
Class<?> ak = Cell.class;
valueOffset = UNSAFE.objectFieldOffset(ak.getDeclaredField("value"));
} catch (Exception e) {
throw new Error(e);
}
}
}
/**
Reported by PMD.
Line: 280
baseOffset = UNSAFE.objectFieldOffset(sk.getDeclaredField("base"));
busyOffset = UNSAFE.objectFieldOffset(sk.getDeclaredField("busy"));
} catch (Exception e) {
throw new Error(e);
}
}
/**
* Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. Replace with a simple call
Reported by PMD.
Line: 310
}
});
} catch (java.security.PrivilegedActionException e) {
throw new RuntimeException("Could not initialize intrinsics", e.getCause());
}
}
}
Reported by PMD.
Line: 182
* @param hc the hash code holder
* @param wasUncontended false if CAS failed before call
*/
final void retryUpdate(long x, @CheckForNull int[] hc, boolean wasUncontended) {
int h;
if (hc == null) {
threadHashCode.set(hc = new int[1]); // Initialize randomly
int r = rng.nextInt(); // Avoid zero to allow xorShift rehash
h = hc[0] = (r == 0) ? 1 : r;
Reported by PMD.
Line: 182
* @param hc the hash code holder
* @param wasUncontended false if CAS failed before call
*/
final void retryUpdate(long x, @CheckForNull int[] hc, boolean wasUncontended) {
int h;
if (hc == null) {
threadHashCode.set(hc = new int[1]); // Initialize randomly
int r = rng.nextInt(); // Avoid zero to allow xorShift rehash
h = hc[0] = (r == 0) ? 1 : r;
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 99
*/
static final class Cell {
volatile long p0, p1, p2, p3, p4, p5, p6;
volatile long value;
volatile long q0, q1, q2, q3, q4, q5, q6;
Cell(long x) {
value = x;
}
Reported by PMD.
Line: 119
UNSAFE = getUnsafe();
Class<?> ak = Cell.class;
valueOffset = UNSAFE.objectFieldOffset(ak.getDeclaredField("value"));
} catch (Exception e) {
throw new Error(e);
}
}
}
Reported by PMD.
guava/src/com/google/common/collect/HashBiMap.java
66 issues
Line: 61
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Object>
extends IteratorBasedAbstractMap<K, V> implements BiMap<K, V>, Serializable {
/** Returns a new, empty {@code HashBiMap} with the default initial capacity (16). */
public static <K extends @Nullable Object, V extends @Nullable Object> HashBiMap<K, V> create() {
return create(16);
Reported by PMD.
Line: 62
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Object>
extends IteratorBasedAbstractMap<K, V> implements BiMap<K, V>, Serializable {
/** Returns a new, empty {@code HashBiMap} with the default initial capacity (16). */
public static <K extends @Nullable Object, V extends @Nullable Object> HashBiMap<K, V> create() {
return create(16);
}
Reported by PMD.
Line: 87
public static <K extends @Nullable Object, V extends @Nullable Object> HashBiMap<K, V> create(
Map<? extends K, ? extends V> map) {
HashBiMap<K, V> bimap = create(map.size());
bimap.putAll(map);
return bimap;
}
private static final class BiEntry<K extends @Nullable Object, V extends @Nullable Object>
extends ImmutableEntry<K, V> {
Reported by PMD.
Line: 91
return bimap;
}
private static final class BiEntry<K extends @Nullable Object, V extends @Nullable Object>
extends ImmutableEntry<K, V> {
final int keyHash;
final int valueHash;
// All BiEntry instances are strongly reachable from owning HashBiMap through
Reported by PMD.
Line: 93
private static final class BiEntry<K extends @Nullable Object, V extends @Nullable Object>
extends ImmutableEntry<K, V> {
final int keyHash;
final int valueHash;
// All BiEntry instances are strongly reachable from owning HashBiMap through
// "HashBiMap.hashTableKToV" and "BiEntry.nextInKToVBucket" references.
// Under that assumption, the remaining references can be safely marked as @Weak.
Reported by PMD.
Line: 94
private static final class BiEntry<K extends @Nullable Object, V extends @Nullable Object>
extends ImmutableEntry<K, V> {
final int keyHash;
final int valueHash;
// All BiEntry instances are strongly reachable from owning HashBiMap through
// "HashBiMap.hashTableKToV" and "BiEntry.nextInKToVBucket" references.
// Under that assumption, the remaining references can be safely marked as @Weak.
// Using @Weak is necessary to avoid retain-cycles between BiEntry instances on iOS,
Reported by PMD.
Line: 102
// Using @Weak is necessary to avoid retain-cycles between BiEntry instances on iOS,
// which would cause memory leaks when non-empty HashBiMap with cyclic BiEntry
// instances is deallocated.
@CheckForNull BiEntry<K, V> nextInKToVBucket;
@Weak @CheckForNull BiEntry<K, V> nextInVToKBucket;
@Weak @CheckForNull BiEntry<K, V> nextInKeyInsertionOrder;
@Weak @CheckForNull BiEntry<K, V> prevInKeyInsertionOrder;
Reported by PMD.
Line: 103
// which would cause memory leaks when non-empty HashBiMap with cyclic BiEntry
// instances is deallocated.
@CheckForNull BiEntry<K, V> nextInKToVBucket;
@Weak @CheckForNull BiEntry<K, V> nextInVToKBucket;
@Weak @CheckForNull BiEntry<K, V> nextInKeyInsertionOrder;
@Weak @CheckForNull BiEntry<K, V> prevInKeyInsertionOrder;
BiEntry(@ParametricNullness K key, int keyHash, @ParametricNullness V value, int valueHash) {
Reported by PMD.
Line: 105
@CheckForNull BiEntry<K, V> nextInKToVBucket;
@Weak @CheckForNull BiEntry<K, V> nextInVToKBucket;
@Weak @CheckForNull BiEntry<K, V> nextInKeyInsertionOrder;
@Weak @CheckForNull BiEntry<K, V> prevInKeyInsertionOrder;
BiEntry(@ParametricNullness K key, int keyHash, @ParametricNullness V value, int valueHash) {
super(key, value);
this.keyHash = keyHash;
Reported by PMD.
Line: 106
@Weak @CheckForNull BiEntry<K, V> nextInVToKBucket;
@Weak @CheckForNull BiEntry<K, V> nextInKeyInsertionOrder;
@Weak @CheckForNull BiEntry<K, V> prevInKeyInsertionOrder;
BiEntry(@ParametricNullness K key, int keyHash, @ParametricNullness V value, int valueHash) {
super(key, value);
this.keyHash = keyHash;
this.valueHash = valueHash;
Reported by PMD.
android/guava/src/com/google/common/cache/Striped64.java
66 issues
Line: 120
Class<?> ak = Cell.class;
valueOffset = UNSAFE.objectFieldOffset(ak.getDeclaredField("value"));
} catch (Exception e) {
throw new Error(e);
}
}
}
/**
Reported by PMD.
Line: 280
baseOffset = UNSAFE.objectFieldOffset(sk.getDeclaredField("base"));
busyOffset = UNSAFE.objectFieldOffset(sk.getDeclaredField("busy"));
} catch (Exception e) {
throw new Error(e);
}
}
/**
* Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. Replace with a simple call
Reported by PMD.
Line: 310
}
});
} catch (java.security.PrivilegedActionException e) {
throw new RuntimeException("Could not initialize intrinsics", e.getCause());
}
}
}
Reported by PMD.
Line: 182
* @param hc the hash code holder
* @param wasUncontended false if CAS failed before call
*/
final void retryUpdate(long x, @CheckForNull int[] hc, boolean wasUncontended) {
int h;
if (hc == null) {
threadHashCode.set(hc = new int[1]); // Initialize randomly
int r = rng.nextInt(); // Avoid zero to allow xorShift rehash
h = hc[0] = (r == 0) ? 1 : r;
Reported by PMD.
Line: 182
* @param hc the hash code holder
* @param wasUncontended false if CAS failed before call
*/
final void retryUpdate(long x, @CheckForNull int[] hc, boolean wasUncontended) {
int h;
if (hc == null) {
threadHashCode.set(hc = new int[1]); // Initialize randomly
int r = rng.nextInt(); // Avoid zero to allow xorShift rehash
h = hc[0] = (r == 0) ? 1 : r;
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 26
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
* updated variables, plus an extra "base" field. The table size
* is a power of two. Indexing uses masked per-thread hash codes.
* Nearly all declarations in this class are package-private,
Reported by PMD.
Line: 99
*/
static final class Cell {
volatile long p0, p1, p2, p3, p4, p5, p6;
volatile long value;
volatile long q0, q1, q2, q3, q4, q5, q6;
Cell(long x) {
value = x;
}
Reported by PMD.
Line: 119
UNSAFE = getUnsafe();
Class<?> ak = Cell.class;
valueOffset = UNSAFE.objectFieldOffset(ak.getDeclaredField("value"));
} catch (Exception e) {
throw new Error(e);
}
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/math/BigDecimalMathTest.java
66 issues
Line: 39
import junit.framework.TestCase;
@GwtIncompatible
public class BigDecimalMathTest extends TestCase {
private static final class RoundToDoubleTester {
private final BigDecimal input;
private final Map<RoundingMode, Double> expectedValues = new EnumMap<>(RoundingMode.class);
private boolean unnecessaryShouldThrow = false;
Reported by PMD.
Line: 41
@GwtIncompatible
public class BigDecimalMathTest extends TestCase {
private static final class RoundToDoubleTester {
private final BigDecimal input;
private final Map<RoundingMode, Double> expectedValues = new EnumMap<>(RoundingMode.class);
private boolean unnecessaryShouldThrow = false;
RoundToDoubleTester(BigDecimal input) {
this.input = input;
Reported by PMD.
Line: 42
public class BigDecimalMathTest extends TestCase {
private static final class RoundToDoubleTester {
private final BigDecimal input;
private final Map<RoundingMode, Double> expectedValues = new EnumMap<>(RoundingMode.class);
private boolean unnecessaryShouldThrow = false;
RoundToDoubleTester(BigDecimal input) {
this.input = input;
}
Reported by PMD.
Line: 43
private static final class RoundToDoubleTester {
private final BigDecimal input;
private final Map<RoundingMode, Double> expectedValues = new EnumMap<>(RoundingMode.class);
private boolean unnecessaryShouldThrow = false;
RoundToDoubleTester(BigDecimal input) {
this.input = input;
}
Reported by PMD.
Line: 43
private static final class RoundToDoubleTester {
private final BigDecimal input;
private final Map<RoundingMode, Double> expectedValues = new EnumMap<>(RoundingMode.class);
private boolean unnecessaryShouldThrow = false;
RoundToDoubleTester(BigDecimal input) {
this.input = input;
}
Reported by PMD.
Line: 64
return this;
}
public void test() {
assertThat(expectedValues.keySet())
.containsAtLeastElementsIn(EnumSet.complementOf(EnumSet.of(UNNECESSARY)));
for (Map.Entry<RoundingMode, Double> entry : expectedValues.entrySet()) {
RoundingMode mode = entry.getKey();
Double expectation = entry.getValue();
Reported by PMD.
Line: 64
return this;
}
public void test() {
assertThat(expectedValues.keySet())
.containsAtLeastElementsIn(EnumSet.complementOf(EnumSet.of(UNNECESSARY)));
for (Map.Entry<RoundingMode, Double> entry : expectedValues.entrySet()) {
RoundingMode mode = entry.getKey();
Double expectation = entry.getValue();
Reported by PMD.
Line: 65
}
public void test() {
assertThat(expectedValues.keySet())
.containsAtLeastElementsIn(EnumSet.complementOf(EnumSet.of(UNNECESSARY)));
for (Map.Entry<RoundingMode, Double> entry : expectedValues.entrySet()) {
RoundingMode mode = entry.getKey();
Double expectation = entry.getValue();
assertWithMessage("roundToDouble(" + input + ", " + mode + ")")
Reported by PMD.
Line: 70
for (Map.Entry<RoundingMode, Double> entry : expectedValues.entrySet()) {
RoundingMode mode = entry.getKey();
Double expectation = entry.getValue();
assertWithMessage("roundToDouble(" + input + ", " + mode + ")")
.that(BigDecimalMath.roundToDouble(input, mode))
.isEqualTo(expectation);
}
if (!expectedValues.containsKey(UNNECESSARY)) {
Reported by PMD.
Line: 70
for (Map.Entry<RoundingMode, Double> entry : expectedValues.entrySet()) {
RoundingMode mode = entry.getKey();
Double expectation = entry.getValue();
assertWithMessage("roundToDouble(" + input + ", " + mode + ")")
.that(BigDecimalMath.roundToDouble(input, mode))
.isEqualTo(expectation);
}
if (!expectedValues.containsKey(UNNECESSARY)) {
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/StripedTest.java
65 issues
Line: 46
*
* @author Dimitris Andreou
*/
public class StripedTest extends TestCase {
private static List<Striped<?>> strongImplementations() {
return ImmutableList.of(
Striped.readWriteLock(100),
Striped.readWriteLock(256),
Striped.lock(100),
Reported by PMD.
Line: 118
return concat(strongImplementations(), weakImplementations());
}
public void testNull() throws Exception {
for (Striped<?> striped : allImplementations()) {
new NullPointerTester().testAllPublicInstanceMethods(striped);
}
}
Reported by PMD.
Line: 118
return concat(strongImplementations(), weakImplementations());
}
public void testNull() throws Exception {
for (Striped<?> striped : allImplementations()) {
new NullPointerTester().testAllPublicInstanceMethods(striped);
}
}
Reported by PMD.
Line: 120
public void testNull() throws Exception {
for (Striped<?> striped : allImplementations()) {
new NullPointerTester().testAllPublicInstanceMethods(striped);
}
}
public void testSizes() {
// not bothering testing all variations, since we know they share implementations
Reported by PMD.
Line: 124
}
}
public void testSizes() {
// not bothering testing all variations, since we know they share implementations
assertTrue(Striped.lock(100).size() >= 100);
assertTrue(Striped.lock(256).size() == 256);
assertTrue(Striped.lazyWeakLock(100).size() >= 100);
assertTrue(Striped.lazyWeakLock(256).size() == 256);
Reported by PMD.
Line: 124
}
}
public void testSizes() {
// not bothering testing all variations, since we know they share implementations
assertTrue(Striped.lock(100).size() >= 100);
assertTrue(Striped.lock(256).size() == 256);
assertTrue(Striped.lazyWeakLock(100).size() >= 100);
assertTrue(Striped.lazyWeakLock(256).size() == 256);
Reported by PMD.
Line: 126
public void testSizes() {
// not bothering testing all variations, since we know they share implementations
assertTrue(Striped.lock(100).size() >= 100);
assertTrue(Striped.lock(256).size() == 256);
assertTrue(Striped.lazyWeakLock(100).size() >= 100);
assertTrue(Striped.lazyWeakLock(256).size() == 256);
}
Reported by PMD.
Line: 126
public void testSizes() {
// not bothering testing all variations, since we know they share implementations
assertTrue(Striped.lock(100).size() >= 100);
assertTrue(Striped.lock(256).size() == 256);
assertTrue(Striped.lazyWeakLock(100).size() >= 100);
assertTrue(Striped.lazyWeakLock(256).size() == 256);
}
Reported by PMD.
Line: 127
public void testSizes() {
// not bothering testing all variations, since we know they share implementations
assertTrue(Striped.lock(100).size() >= 100);
assertTrue(Striped.lock(256).size() == 256);
assertTrue(Striped.lazyWeakLock(100).size() >= 100);
assertTrue(Striped.lazyWeakLock(256).size() == 256);
}
Reported by PMD.
Line: 127
public void testSizes() {
// not bothering testing all variations, since we know they share implementations
assertTrue(Striped.lock(100).size() >= 100);
assertTrue(Striped.lock(256).size() == 256);
assertTrue(Striped.lazyWeakLock(100).size() >= 100);
assertTrue(Striped.lazyWeakLock(256).size() == 256);
}
Reported by PMD.
android/guava/src/com/google/common/base/CharMatcher.java
65 issues
Line: 887
int end,
char replacement,
StringBuilder builder,
boolean inMatchingGroup) {
for (int i = start; i < end; i++) {
char c = sequence.charAt(i);
if (matches(c)) {
if (!inMatchingGroup) {
builder.append(replacement);
Reported by PMD.
Line: 887
int end,
char replacement,
StringBuilder builder,
boolean inMatchingGroup) {
for (int i = start; i < end; i++) {
char c = sequence.charAt(i);
if (matches(c)) {
if (!inMatchingGroup) {
builder.append(replacement);
Reported by PMD.
Line: 926
* Returns the Java Unicode escape sequence for the given {@code char}, in the form "\u12AB" where
* "12AB" is the four hexadecimal digits representing the 16-bit code unit.
*/
private static String showCharacter(char c) {
String hex = "0123456789ABCDEF";
char[] tmp = {'\\', 'u', '\0', '\0', '\0', '\0'};
for (int i = 0; i < 4; i++) {
tmp[5 - i] = hex.charAt(c & 0xF);
c = (char) (c >> 4);
Reported by PMD.
Line: 986
private final BitSet table;
private BitSetMatcher(BitSet table, String description) {
super(description);
if (table.length() + Long.SIZE < table.size()) {
table = (BitSet) table.clone();
// If only we could actually call BitSet.trimToSize() ourselves...
}
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.base;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkPositionIndex;
Reported by PMD.
Line: 65
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public abstract class CharMatcher implements Predicate<Character> {
/*
* N777777777NO
* N7777777777777N
* M777777777777777N
* $N877777777D77777M
Reported by PMD.
Line: 65
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public abstract class CharMatcher implements Predicate<Character> {
/*
* N777777777NO
* N7777777777777N
* M777777777777777N
* $N877777777D77777M
Reported by PMD.
Line: 65
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public abstract class CharMatcher implements Predicate<Character> {
/*
* N777777777NO
* N7777777777777N
* M777777777777777N
* $N877777777D77777M
Reported by PMD.
Line: 65
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public abstract class CharMatcher implements Predicate<Character> {
/*
* N777777777NO
* N7777777777777N
* M777777777777777N
* $N877777777D77777M
Reported by PMD.
Line: 332
* character sequence. Returns a bogus matcher if the sequence contains supplementary characters.
*/
public static CharMatcher noneOf(CharSequence sequence) {
return anyOf(sequence).negate();
}
/**
* Returns a {@code char} matcher that matches any character in a given BMP range (both endpoints
* are inclusive). For example, to match any lowercase letter of the English alphabet, use {@code
Reported by PMD.