The following issues were found
android/guava/src/com/google/common/collect/RegularContiguousSet.java
15 issues
Line: 37
@GwtCompatible(emulated = true)
@SuppressWarnings("unchecked") // allow ungenerified Comparable types
@ElementTypesAreNonnullByDefault
final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C> {
private final Range<C> range;
RegularContiguousSet(Range<C> range, DiscreteDomain<C> domain) {
super(domain);
this.range = range;
Reported by PMD.
Line: 38
@SuppressWarnings("unchecked") // allow ungenerified Comparable types
@ElementTypesAreNonnullByDefault
final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C> {
private final Range<C> range;
RegularContiguousSet(Range<C> range, DiscreteDomain<C> domain) {
super(domain);
this.range = range;
}
Reported by PMD.
Line: 38
@SuppressWarnings("unchecked") // allow ungenerified Comparable types
@ElementTypesAreNonnullByDefault
final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C> {
private final Range<C> range;
RegularContiguousSet(Range<C> range, DiscreteDomain<C> domain) {
super(domain);
this.range = range;
}
Reported by PMD.
Line: 120
@Override
public C first() {
// requireNonNull is safe because we checked the range is not empty in ContiguousSet.create.
return requireNonNull(range.lowerBound.leastValueAbove(domain));
}
@Override
public C last() {
// requireNonNull is safe because we checked the range is not empty in ContiguousSet.create.
Reported by PMD.
Line: 126
@Override
public C last() {
// requireNonNull is safe because we checked the range is not empty in ContiguousSet.create.
return requireNonNull(range.upperBound.greatestValueBelow(domain));
}
@Override
ImmutableList<C> createAsList() {
if (domain.supportsFastOffset) {
Reported by PMD.
Line: 184
if (other.isEmpty()) {
return other;
} else {
C lowerEndpoint = Ordering.natural().max(this.first(), other.first());
C upperEndpoint = Ordering.natural().min(this.last(), other.last());
return (lowerEndpoint.compareTo(upperEndpoint) <= 0)
? ContiguousSet.create(Range.closed(lowerEndpoint, upperEndpoint), domain)
: new EmptyContiguousSet<C>(domain);
}
Reported by PMD.
Line: 185
return other;
} else {
C lowerEndpoint = Ordering.natural().max(this.first(), other.first());
C upperEndpoint = Ordering.natural().min(this.last(), other.last());
return (lowerEndpoint.compareTo(upperEndpoint) <= 0)
? ContiguousSet.create(Range.closed(lowerEndpoint, upperEndpoint), domain)
: new EmptyContiguousSet<C>(domain);
}
}
Reported by PMD.
Line: 186
} else {
C lowerEndpoint = Ordering.natural().max(this.first(), other.first());
C upperEndpoint = Ordering.natural().min(this.last(), other.last());
return (lowerEndpoint.compareTo(upperEndpoint) <= 0)
? ContiguousSet.create(Range.closed(lowerEndpoint, upperEndpoint), domain)
: new EmptyContiguousSet<C>(domain);
}
}
Reported by PMD.
Line: 200
@Override
public Range<C> range(BoundType lowerBoundType, BoundType upperBoundType) {
return Range.create(
range.lowerBound.withLowerBoundType(lowerBoundType, domain),
range.upperBound.withUpperBoundType(upperBoundType, domain));
}
@Override
public boolean equals(@CheckForNull Object object) {
Reported by PMD.
Line: 201
public Range<C> range(BoundType lowerBoundType, BoundType upperBoundType) {
return Range.create(
range.lowerBound.withLowerBoundType(lowerBoundType, domain),
range.upperBound.withUpperBoundType(upperBoundType, domain));
}
@Override
public boolean equals(@CheckForNull Object object) {
if (object == this) {
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/ListMultimapPutTester.java
15 issues
Line: 40
public class ListMultimapPutTester<K, V> extends AbstractListMultimapTester<K, V> {
// MultimapPutTester tests non-duplicate values, but ignores ordering
@MapFeature.Require(SUPPORTS_PUT)
public void testPutAddsValueAtEnd() {
for (K key : sampleKeys()) {
for (V value : sampleValues()) {
resetContainer();
Reported by PMD.
Line: 41
// MultimapPutTester tests non-duplicate values, but ignores ordering
@MapFeature.Require(SUPPORTS_PUT)
public void testPutAddsValueAtEnd() {
for (K key : sampleKeys()) {
for (V value : sampleValues()) {
resetContainer();
List<V> values = multimap().get(key);
Reported by PMD.
Line: 46
for (V value : sampleValues()) {
resetContainer();
List<V> values = multimap().get(key);
List<V> expectedValues = Helpers.copyToList(values);
assertTrue(multimap().put(key, value));
expectedValues.add(value);
Reported by PMD.
Line: 49
List<V> values = multimap().get(key);
List<V> expectedValues = Helpers.copyToList(values);
assertTrue(multimap().put(key, value));
expectedValues.add(value);
assertGet(key, expectedValues);
assertEquals(value, values.get(values.size() - 1));
}
Reported by PMD.
Line: 50
List<V> expectedValues = Helpers.copyToList(values);
assertTrue(multimap().put(key, value));
expectedValues.add(value);
assertGet(key, expectedValues);
assertEquals(value, values.get(values.size() - 1));
}
}
Reported by PMD.
Line: 53
expectedValues.add(value);
assertGet(key, expectedValues);
assertEquals(value, values.get(values.size() - 1));
}
}
}
@MapFeature.Require(SUPPORTS_PUT)
Reported by PMD.
Line: 53
expectedValues.add(value);
assertGet(key, expectedValues);
assertEquals(value, values.get(values.size() - 1));
}
}
}
@MapFeature.Require(SUPPORTS_PUT)
Reported by PMD.
Line: 58
}
}
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPutDuplicateValue() {
List<Entry<K, V>> entries = copyToList(multimap().entries());
for (Entry<K, V> entry : entries) {
Reported by PMD.
Line: 60
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPutDuplicateValue() {
List<Entry<K, V>> entries = copyToList(multimap().entries());
for (Entry<K, V> entry : entries) {
resetContainer();
Reported by PMD.
Line: 61
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPutDuplicateValue() {
List<Entry<K, V>> entries = copyToList(multimap().entries());
for (Entry<K, V> entry : entries) {
resetContainer();
K k = entry.getKey();
Reported by PMD.
android/guava/src/com/google/common/base/Utf8.java
15 issues
Line: 42
@Beta
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Utf8 {
/**
* Returns the number of bytes in the UTF-8-encoded form of {@code sequence}. For a string, this
* method is equivalent to {@code string.getBytes(UTF_8).length}, but is more efficient in both
* time and space.
*
Reported by PMD.
Line: 42
@Beta
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Utf8 {
/**
* Returns the number of bytes in the UTF-8-encoded form of {@code sequence}. For a string, this
* method is equivalent to {@code string.getBytes(UTF_8).length}, but is more efficient in both
* time and space.
*
Reported by PMD.
Line: 65
// This loop optimizes for chars less than 0x800.
for (; i < utf16Length; i++) {
char c = sequence.charAt(i);
if (c < 0x800) {
utf8Length += ((0x7f - c) >>> 31); // branch free!
} else {
utf8Length += encodedLengthGeneral(sequence, i);
break;
}
Reported by PMD.
Line: 86
int utf8Length = 0;
for (int i = start; i < utf16Length; i++) {
char c = sequence.charAt(i);
if (c < 0x800) {
utf8Length += (0x7f - c) >>> 31; // branch free!
} else {
utf8Length += 2;
// jdk7+: if (Character.isSurrogate(c)) {
if (MIN_SURROGATE <= c && c <= MAX_SURROGATE) {
Reported by PMD.
Line: 96
if (Character.codePointAt(sequence, i) == c) {
throw new IllegalArgumentException(unpairedSurrogateMsg(i));
}
i++;
}
}
}
return utf8Length;
}
Reported by PMD.
Line: 138
return true;
}
private static boolean isWellFormedSlowPath(byte[] bytes, int off, int end) {
int index = off;
while (true) {
int byte1;
// Optimize for interior runs of ASCII bytes.
Reported by PMD.
Line: 138
return true;
}
private static boolean isWellFormedSlowPath(byte[] bytes, int off, int end) {
int index = off;
while (true) {
int byte1;
// Optimize for interior runs of ASCII bytes.
Reported by PMD.
Line: 138
return true;
}
private static boolean isWellFormedSlowPath(byte[] bytes, int off, int end) {
int index = off;
while (true) {
int byte1;
// Optimize for interior runs of ASCII bytes.
Reported by PMD.
Line: 157
}
// Simultaneously check for illegal trailing-byte in leading position
// and overlong 2-byte form.
if (byte1 < (byte) 0xC2 || bytes[index++] > (byte) 0xBF) {
return false;
}
} else if (byte1 < (byte) 0xF0) {
// Three-byte form.
if (index + 1 >= end) {
Reported by PMD.
Line: 166
return false;
}
int byte2 = bytes[index++];
if (byte2 > (byte) 0xBF
// Overlong? 5 most significant bits must not all be zero.
|| (byte1 == (byte) 0xE0 && byte2 < (byte) 0xA0)
// Check for illegal surrogate codepoints.
|| (byte1 == (byte) 0xED && (byte) 0xA0 <= byte2)
// Third byte trailing-byte test.
Reported by PMD.
android/guava/src/com/google/common/collect/ForwardingSortedSet.java
15 issues
Line: 71
@Override
@CheckForNull
public Comparator<? super E> comparator() {
return delegate().comparator();
}
@Override
@ParametricNullness
public E first() {
Reported by PMD.
Line: 77
@Override
@ParametricNullness
public E first() {
return delegate().first();
}
@Override
public SortedSet<E> headSet(@ParametricNullness E toElement) {
return delegate().headSet(toElement);
Reported by PMD.
Line: 82
@Override
public SortedSet<E> headSet(@ParametricNullness E toElement) {
return delegate().headSet(toElement);
}
@Override
@ParametricNullness
public E last() {
Reported by PMD.
Line: 88
@Override
@ParametricNullness
public E last() {
return delegate().last();
}
@Override
public SortedSet<E> subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) {
return delegate().subSet(fromElement, toElement);
Reported by PMD.
Line: 93
@Override
public SortedSet<E> subSet(@ParametricNullness E fromElement, @ParametricNullness E toElement) {
return delegate().subSet(fromElement, toElement);
}
@Override
public SortedSet<E> tailSet(@ParametricNullness E fromElement) {
return delegate().tailSet(fromElement);
Reported by PMD.
Line: 98
@Override
public SortedSet<E> tailSet(@ParametricNullness E fromElement) {
return delegate().tailSet(fromElement);
}
/**
* A sensible definition of {@link #contains} in terms of the {@code first()} method of {@link
* #tailSet}. If you override {@link #tailSet}, you may wish to override {@link #contains} to
Reported by PMD.
Line: 115
// any ClassCastExceptions and NullPointerExceptions are caught
@SuppressWarnings({"unchecked", "nullness"})
SortedSet<@Nullable Object> self = (SortedSet<@Nullable Object>) this;
Object ceiling = self.tailSet(object).first();
return unsafeCompare(comparator(), ceiling, object) == 0;
} catch (ClassCastException | NoSuchElementException | NullPointerException e) {
return false;
}
}
Reported by PMD.
Line: 115
// any ClassCastExceptions and NullPointerExceptions are caught
@SuppressWarnings({"unchecked", "nullness"})
SortedSet<@Nullable Object> self = (SortedSet<@Nullable Object>) this;
Object ceiling = self.tailSet(object).first();
return unsafeCompare(comparator(), ceiling, object) == 0;
} catch (ClassCastException | NoSuchElementException | NullPointerException e) {
return false;
}
}
Reported by PMD.
Line: 117
SortedSet<@Nullable Object> self = (SortedSet<@Nullable Object>) this;
Object ceiling = self.tailSet(object).first();
return unsafeCompare(comparator(), ceiling, object) == 0;
} catch (ClassCastException | NoSuchElementException | NullPointerException e) {
return false;
}
}
/**
Reported by PMD.
Line: 117
SortedSet<@Nullable Object> self = (SortedSet<@Nullable Object>) this;
Object ceiling = self.tailSet(object).first();
return unsafeCompare(comparator(), ceiling, object) == 0;
} catch (ClassCastException | NoSuchElementException | NullPointerException e) {
return false;
}
}
/**
Reported by PMD.
android/guava/src/com/google/common/collect/RegularImmutableTable.java
15 issues
Line: 36
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
abstract class RegularImmutableTable<R, C, V> extends ImmutableTable<R, C, V> {
RegularImmutableTable() {}
abstract Cell<R, C, V> getCell(int iterationIndex);
@Override
Reported by PMD.
Line: 47
}
@WeakOuter
private final class CellSet extends IndexedImmutableSet<Cell<R, C, V>> {
@Override
public int size() {
return RegularImmutableTable.this.size();
}
Reported by PMD.
Line: 50
private final class CellSet extends IndexedImmutableSet<Cell<R, C, V>> {
@Override
public int size() {
return RegularImmutableTable.this.size();
}
@Override
Cell<R, C, V> get(int index) {
return getCell(index);
Reported by PMD.
Line: 50
private final class CellSet extends IndexedImmutableSet<Cell<R, C, V>> {
@Override
public int size() {
return RegularImmutableTable.this.size();
}
@Override
Cell<R, C, V> get(int index) {
return getCell(index);
Reported by PMD.
Line: 62
public boolean contains(@CheckForNull Object object) {
if (object instanceof Cell) {
Cell<?, ?, ?> cell = (Cell<?, ?, ?>) object;
Object value = RegularImmutableTable.this.get(cell.getRowKey(), cell.getColumnKey());
return value != null && value.equals(cell.getValue());
}
return false;
}
Reported by PMD.
Line: 62
public boolean contains(@CheckForNull Object object) {
if (object instanceof Cell) {
Cell<?, ?, ?> cell = (Cell<?, ?, ?>) object;
Object value = RegularImmutableTable.this.get(cell.getRowKey(), cell.getColumnKey());
return value != null && value.equals(cell.getValue());
}
return false;
}
Reported by PMD.
Line: 62
public boolean contains(@CheckForNull Object object) {
if (object instanceof Cell) {
Cell<?, ?, ?> cell = (Cell<?, ?, ?>) object;
Object value = RegularImmutableTable.this.get(cell.getRowKey(), cell.getColumnKey());
return value != null && value.equals(cell.getValue());
}
return false;
}
Reported by PMD.
Line: 62
public boolean contains(@CheckForNull Object object) {
if (object instanceof Cell) {
Cell<?, ?, ?> cell = (Cell<?, ?, ?>) object;
Object value = RegularImmutableTable.this.get(cell.getRowKey(), cell.getColumnKey());
return value != null && value.equals(cell.getValue());
}
return false;
}
Reported by PMD.
Line: 63
if (object instanceof Cell) {
Cell<?, ?, ?> cell = (Cell<?, ?, ?>) object;
Object value = RegularImmutableTable.this.get(cell.getRowKey(), cell.getColumnKey());
return value != null && value.equals(cell.getValue());
}
return false;
}
@Override
Reported by PMD.
Line: 63
if (object instanceof Cell) {
Cell<?, ?, ?> cell = (Cell<?, ?, ?>) object;
Object value = RegularImmutableTable.this.get(cell.getRowKey(), cell.getColumnKey());
return value != null && value.equals(cell.getValue());
}
return false;
}
@Override
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/MapTestSuiteBuilder.java
15 issues
Line: 220
}
public static Set<Feature<?>> computeCommonDerivedCollectionFeatures(
Set<Feature<?>> mapFeatures) {
mapFeatures = new HashSet<>(mapFeatures);
Set<Feature<?>> derivedFeatures = new HashSet<>();
mapFeatures.remove(CollectionFeature.SERIALIZABLE);
if (mapFeatures.remove(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
derivedFeatures.add(CollectionFeature.SERIALIZABLE);
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect.testing;
import static com.google.common.collect.testing.DerivedCollectionGenerators.keySetGenerator;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.testing.DerivedCollectionGenerators.MapEntrySetGenerator;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect.testing;
import static com.google.common.collect.testing.DerivedCollectionGenerators.keySetGenerator;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.testing.DerivedCollectionGenerators.MapEntrySetGenerator;
Reported by PMD.
Line: 119
List<TestSuite> derivedSuites = super.createDerivedSuites(parentBuilder);
if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
derivedSuites.add(
MapTestSuiteBuilder.using(
new ReserializedMapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
.withFeatures(computeReserializedMapFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " reserialized")
Reported by PMD.
Line: 141
.withTearDown(parentBuilder.getTearDown())
.createTestSuite());
derivedSuites.add(
createDerivedKeySetSuite(keySetGenerator(parentBuilder.getSubjectGenerator()))
.withFeatures(computeKeySetFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " keys")
.suppressing(parentBuilder.getSuppressedTests())
.withSetUp(parentBuilder.getSetUp())
Reported by PMD.
Line: 142
.createTestSuite());
derivedSuites.add(
createDerivedKeySetSuite(keySetGenerator(parentBuilder.getSubjectGenerator()))
.withFeatures(computeKeySetFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " keys")
.suppressing(parentBuilder.getSuppressedTests())
.withSetUp(parentBuilder.getSetUp())
.withTearDown(parentBuilder.getTearDown())
Reported by PMD.
Line: 142
.createTestSuite());
derivedSuites.add(
createDerivedKeySetSuite(keySetGenerator(parentBuilder.getSubjectGenerator()))
.withFeatures(computeKeySetFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " keys")
.suppressing(parentBuilder.getSuppressedTests())
.withSetUp(parentBuilder.getSetUp())
.withTearDown(parentBuilder.getTearDown())
Reported by PMD.
Line: 142
.createTestSuite());
derivedSuites.add(
createDerivedKeySetSuite(keySetGenerator(parentBuilder.getSubjectGenerator()))
.withFeatures(computeKeySetFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " keys")
.suppressing(parentBuilder.getSuppressedTests())
.withSetUp(parentBuilder.getSetUp())
.withTearDown(parentBuilder.getTearDown())
Reported by PMD.
Line: 142
.createTestSuite());
derivedSuites.add(
createDerivedKeySetSuite(keySetGenerator(parentBuilder.getSubjectGenerator()))
.withFeatures(computeKeySetFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " keys")
.suppressing(parentBuilder.getSuppressedTests())
.withSetUp(parentBuilder.getSetUp())
.withTearDown(parentBuilder.getTearDown())
Reported by PMD.
Line: 142
.createTestSuite());
derivedSuites.add(
createDerivedKeySetSuite(keySetGenerator(parentBuilder.getSubjectGenerator()))
.withFeatures(computeKeySetFeatures(parentBuilder.getFeatures()))
.named(parentBuilder.getName() + " keys")
.suppressing(parentBuilder.getSuppressedTests())
.withSetUp(parentBuilder.getSetUp())
.withTearDown(parentBuilder.getTearDown())
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java
15 issues
Line: 243
}
@Override
long storedPermitsToWaitTime(double storedPermits, double permitsToTake) {
double availablePermitsAboveThreshold = storedPermits - thresholdPermits;
long micros = 0;
// measuring the integral on the right part of the function (the climbing line)
if (availablePermitsAboveThreshold > 0.0) {
double permitsAboveThresholdToTake = min(availablePermitsAboveThreshold, permitsToTake);
Reported by PMD.
Line: 26
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class SmoothRateLimiter extends RateLimiter {
/*
* How is the RateLimiter designed, and why?
*
* The primary feature of a RateLimiter is its "stable rate", the maximum rate that it should
* allow in normal conditions. This is enforced by "throttling" incoming requests as needed. For
Reported by PMD.
Line: 206
* </ul>
*/
static final class SmoothWarmingUp extends SmoothRateLimiter {
private final long warmupPeriodMicros;
/**
* The slope of the line from the stable interval (when permits == 0), to the cold interval
* (when permits == maxPermits)
*/
private double slope;
Reported by PMD.
Line: 211
* The slope of the line from the stable interval (when permits == 0), to the cold interval
* (when permits == maxPermits)
*/
private double slope;
private double thresholdPermits;
private double coldFactor;
SmoothWarmingUp(
Reported by PMD.
Line: 213
*/
private double slope;
private double thresholdPermits;
private double coldFactor;
SmoothWarmingUp(
SleepingStopwatch stopwatch, long warmupPeriod, TimeUnit timeUnit, double coldFactor) {
super(stopwatch);
Reported by PMD.
Line: 214
private double slope;
private double thresholdPermits;
private double coldFactor;
SmoothWarmingUp(
SleepingStopwatch stopwatch, long warmupPeriod, TimeUnit timeUnit, double coldFactor) {
super(stopwatch);
this.warmupPeriodMicros = timeUnit.toMicros(warmupPeriod);
Reported by PMD.
Line: 214
private double slope;
private double thresholdPermits;
private double coldFactor;
SmoothWarmingUp(
SleepingStopwatch stopwatch, long warmupPeriod, TimeUnit timeUnit, double coldFactor) {
super(stopwatch);
this.warmupPeriodMicros = timeUnit.toMicros(warmupPeriod);
Reported by PMD.
Line: 247
double availablePermitsAboveThreshold = storedPermits - thresholdPermits;
long micros = 0;
// measuring the integral on the right part of the function (the climbing line)
if (availablePermitsAboveThreshold > 0.0) {
double permitsAboveThresholdToTake = min(availablePermitsAboveThreshold, permitsToTake);
// TODO(cpovirk): Figure out a good name for this variable.
double length =
permitsToTime(availablePermitsAboveThreshold)
+ permitsToTime(availablePermitsAboveThreshold - permitsAboveThresholdToTake);
Reported by PMD.
Line: 279
*/
static final class SmoothBursty extends SmoothRateLimiter {
/** The work (permits) of how many seconds can be saved up if this RateLimiter is unused? */
final double maxBurstSeconds;
SmoothBursty(SleepingStopwatch stopwatch, double maxBurstSeconds) {
super(stopwatch);
this.maxBurstSeconds = maxBurstSeconds;
}
Reported by PMD.
Line: 313
}
/** The currently stored permits. */
double storedPermits;
/** The maximum number of stored permits. */
double maxPermits;
/**
Reported by PMD.
android/guava/src/com/google/common/hash/MessageDigestHashFunction.java
15 issues
Line: 36
*/
@Immutable
@ElementTypesAreNonnullByDefault
final class MessageDigestHashFunction extends AbstractHashFunction implements Serializable {
@SuppressWarnings("Immutable") // cloned before each use
private final MessageDigest prototype;
private final int bytes;
Reported by PMD.
Line: 39
final class MessageDigestHashFunction extends AbstractHashFunction implements Serializable {
@SuppressWarnings("Immutable") // cloned before each use
private final MessageDigest prototype;
private final int bytes;
private final boolean supportsClone;
private final String toString;
Reported by PMD.
Line: 39
final class MessageDigestHashFunction extends AbstractHashFunction implements Serializable {
@SuppressWarnings("Immutable") // cloned before each use
private final MessageDigest prototype;
private final int bytes;
private final boolean supportsClone;
private final String toString;
Reported by PMD.
Line: 41
@SuppressWarnings("Immutable") // cloned before each use
private final MessageDigest prototype;
private final int bytes;
private final boolean supportsClone;
private final String toString;
MessageDigestHashFunction(String algorithmName, String toString) {
this.prototype = getMessageDigest(algorithmName);
Reported by PMD.
Line: 42
private final MessageDigest prototype;
private final int bytes;
private final boolean supportsClone;
private final String toString;
MessageDigestHashFunction(String algorithmName, String toString) {
this.prototype = getMessageDigest(algorithmName);
this.bytes = prototype.getDigestLength();
Reported by PMD.
Line: 42
private final MessageDigest prototype;
private final int bytes;
private final boolean supportsClone;
private final String toString;
MessageDigestHashFunction(String algorithmName, String toString) {
this.prototype = getMessageDigest(algorithmName);
this.bytes = prototype.getDigestLength();
Reported by PMD.
Line: 43
private final int bytes;
private final boolean supportsClone;
private final String toString;
MessageDigestHashFunction(String algorithmName, String toString) {
this.prototype = getMessageDigest(algorithmName);
this.bytes = prototype.getDigestLength();
this.toString = checkNotNull(toString);
Reported by PMD.
Line: 43
private final int bytes;
private final boolean supportsClone;
private final String toString;
MessageDigestHashFunction(String algorithmName, String toString) {
this.prototype = getMessageDigest(algorithmName);
this.bytes = prototype.getDigestLength();
this.toString = checkNotNull(toString);
Reported by PMD.
Line: 102
}
private static final class SerializedForm implements Serializable {
private final String algorithmName;
private final int bytes;
private final String toString;
private SerializedForm(String algorithmName, int bytes, String toString) {
this.algorithmName = algorithmName;
Reported by PMD.
Line: 103
private static final class SerializedForm implements Serializable {
private final String algorithmName;
private final int bytes;
private final String toString;
private SerializedForm(String algorithmName, int bytes, String toString) {
this.algorithmName = algorithmName;
this.bytes = bytes;
Reported by PMD.
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableList.java
15 issues
Line: 28
*
* @author Hayward Chan
*/
abstract class ForwardingImmutableList<E> extends ImmutableList<E> {
ForwardingImmutableList() {}
abstract List<E> delegateList();
Reported by PMD.
Line: 28
*
* @author Hayward Chan
*/
abstract class ForwardingImmutableList<E> extends ImmutableList<E> {
ForwardingImmutableList() {}
abstract List<E> delegateList();
Reported by PMD.
Line: 35
abstract List<E> delegateList();
public int indexOf(@Nullable Object object) {
return delegateList().indexOf(object);
}
public int lastIndexOf(@Nullable Object object) {
return delegateList().lastIndexOf(object);
}
Reported by PMD.
Line: 39
}
public int lastIndexOf(@Nullable Object object) {
return delegateList().lastIndexOf(object);
}
public E get(int index) {
return delegateList().get(index);
}
Reported by PMD.
Line: 43
}
public E get(int index) {
return delegateList().get(index);
}
public ImmutableList<E> subList(int fromIndex, int toIndex) {
return unsafeDelegateList(delegateList().subList(fromIndex, toIndex));
}
Reported by PMD.
Line: 47
}
public ImmutableList<E> subList(int fromIndex, int toIndex) {
return unsafeDelegateList(delegateList().subList(fromIndex, toIndex));
}
@Override
public Object[] toArray() {
// Note that ArrayList.toArray() doesn't work here because it returns E[]
Reported by PMD.
Line: 59
@Override
public boolean equals(Object obj) {
return delegateList().equals(obj);
}
@Override
public int hashCode() {
return delegateList().hashCode();
Reported by PMD.
Line: 64
@Override
public int hashCode() {
return delegateList().hashCode();
}
@Override
public UnmodifiableIterator<E> iterator() {
return Iterators.unmodifiableIterator(delegateList().iterator());
Reported by PMD.
Line: 69
@Override
public UnmodifiableIterator<E> iterator() {
return Iterators.unmodifiableIterator(delegateList().iterator());
}
@Override
public boolean contains(@Nullable Object object) {
return object != null && delegateList().contains(object);
Reported by PMD.
Line: 74
@Override
public boolean contains(@Nullable Object object) {
return object != null && delegateList().contains(object);
}
@Override
public boolean containsAll(Collection<?> targets) {
return delegateList().containsAll(targets);
Reported by PMD.
android/guava-tests/benchmark/com/google/common/math/StatsBenchmark.java
15 issues
Line: 73
}
static class MeanAndVariance {
private final double mean;
private final double variance;
MeanAndVariance(double mean, double variance) {
this.mean = mean;
this.variance = variance;
Reported by PMD.
Line: 74
static class MeanAndVariance {
private final double mean;
private final double variance;
MeanAndVariance(double mean, double variance) {
this.mean = mean;
this.variance = variance;
}
Reported by PMD.
Line: 82
}
@Override
public int hashCode() {
return Doubles.hashCode(mean) * 31 + Doubles.hashCode(variance);
}
}
enum VarianceAlgorithm {
Reported by PMD.
Line: 144
}
@Param({"100", "10000"})
int n;
@Param MeanAlgorithm meanAlgorithm;
@Param VarianceAlgorithm varianceAlgorithm;
private double[][] values = new double[0x100][];
Reported by PMD.
Line: 146
@Param({"100", "10000"})
int n;
@Param MeanAlgorithm meanAlgorithm;
@Param VarianceAlgorithm varianceAlgorithm;
private double[][] values = new double[0x100][];
@BeforeExperiment
Reported by PMD.
Line: 147
int n;
@Param MeanAlgorithm meanAlgorithm;
@Param VarianceAlgorithm varianceAlgorithm;
private double[][] values = new double[0x100][];
@BeforeExperiment
void setUp() {
Reported by PMD.
Line: 149
@Param MeanAlgorithm meanAlgorithm;
@Param VarianceAlgorithm varianceAlgorithm;
private double[][] values = new double[0x100][];
@BeforeExperiment
void setUp() {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
Reported by PMD.
Line: 151
private double[][] values = new double[0x100][];
@BeforeExperiment
void setUp() {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
values[i] = new double[n];
for (int j = 0; j < n; j++) {
Reported by PMD.
Line: 166
int meanAndVariance(int reps) {
int tmp = 0;
for (int i = 0; i < reps; i++) {
tmp += varianceAlgorithm.variance(values[i & 0xFF], meanAlgorithm).hashCode();
}
return tmp;
}
}
Reported by PMD.
Line: 69
}
};
abstract double mean(double[] values);
}
static class MeanAndVariance {
private final double mean;
private final double variance;
Reported by PMD.