The following issues were found
android/guava/src/com/google/common/collect/ImmutableTable.java
22 issues
Line: 45
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V>
implements Serializable {
/**
* Returns an empty immutable table.
*
Reported by PMD.
Line: 46
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V>
implements Serializable {
/**
* Returns an empty immutable table.
*
* <p><b>Performance note:</b> the instance returned is a singleton.
Reported by PMD.
Line: 143
*/
@DoNotMock
public static final class Builder<R, C, V> {
private final List<Cell<R, C, V>> cells = Lists.newArrayList();
@CheckForNull private Comparator<? super R> rowComparator;
@CheckForNull private Comparator<? super C> columnComparator;
/**
* Creates a new builder. The returned builder is equivalent to the builder generated by {@link
Reported by PMD.
Line: 144
@DoNotMock
public static final class Builder<R, C, V> {
private final List<Cell<R, C, V>> cells = Lists.newArrayList();
@CheckForNull private Comparator<? super R> rowComparator;
@CheckForNull private Comparator<? super C> columnComparator;
/**
* Creates a new builder. The returned builder is equivalent to the builder generated by {@link
* ImmutableTable#builder}.
Reported by PMD.
Line: 145
public static final class Builder<R, C, V> {
private final List<Cell<R, C, V>> cells = Lists.newArrayList();
@CheckForNull private Comparator<? super R> rowComparator;
@CheckForNull private Comparator<? super C> columnComparator;
/**
* Creates a new builder. The returned builder is equivalent to the builder generated by {@link
* ImmutableTable#builder}.
*/
Reported by PMD.
Line: 271
public ImmutableMap<R, V> column(C columnKey) {
checkNotNull(columnKey, "columnKey");
return MoreObjects.firstNonNull(
(ImmutableMap<R, V>) columnMap().get(columnKey), ImmutableMap.<R, V>of());
}
@Override
public ImmutableSet<C> columnKeySet() {
return columnMap().keySet();
Reported by PMD.
Line: 276
@Override
public ImmutableSet<C> columnKeySet() {
return columnMap().keySet();
}
/**
* {@inheritDoc}
*
Reported by PMD.
Line: 297
public ImmutableMap<C, V> row(R rowKey) {
checkNotNull(rowKey, "rowKey");
return MoreObjects.firstNonNull(
(ImmutableMap<C, V>) rowMap().get(rowKey), ImmutableMap.<C, V>of());
}
@Override
public ImmutableSet<R> rowKeySet() {
return rowMap().keySet();
Reported by PMD.
Line: 302
@Override
public ImmutableSet<R> rowKeySet() {
return rowMap().keySet();
}
/**
* {@inheritDoc}
*
Reported by PMD.
Line: 321
@Override
public boolean containsValue(@CheckForNull Object value) {
return values().contains(value);
}
/**
* Guaranteed to throw an exception and leave the table unmodified.
*
Reported by PMD.
guava/src/com/google/common/hash/Murmur3_128HashFunction.java
22 issues
Line: 191
.array());
}
private static long fmix64(long k) {
k ^= k >>> 33;
k *= 0xff51afd7ed558ccdL;
k ^= k >>> 33;
k *= 0xc4ceb9fe1a85ec53L;
k ^= k >>> 33;
Reported by PMD.
Line: 191
.array());
}
private static long fmix64(long k) {
k ^= k >>> 33;
k *= 0xff51afd7ed558ccdL;
k ^= k >>> 33;
k *= 0xc4ceb9fe1a85ec53L;
k ^= k >>> 33;
Reported by PMD.
Line: 191
.array());
}
private static long fmix64(long k) {
k ^= k >>> 33;
k *= 0xff51afd7ed558ccdL;
k ^= k >>> 33;
k *= 0xc4ceb9fe1a85ec53L;
k ^= k >>> 33;
Reported by PMD.
Line: 191
.array());
}
private static long fmix64(long k) {
k ^= k >>> 33;
k *= 0xff51afd7ed558ccdL;
k ^= k >>> 33;
k *= 0xc4ceb9fe1a85ec53L;
k ^= k >>> 33;
Reported by PMD.
Line: 191
.array());
}
private static long fmix64(long k) {
k ^= k >>> 33;
k *= 0xff51afd7ed558ccdL;
k ^= k >>> 33;
k *= 0xc4ceb9fe1a85ec53L;
k ^= k >>> 33;
Reported by PMD.
Line: 200
return k;
}
private static long mixK1(long k1) {
k1 *= C1;
k1 = Long.rotateLeft(k1, 31);
k1 *= C2;
return k1;
}
Reported by PMD.
Line: 200
return k;
}
private static long mixK1(long k1) {
k1 *= C1;
k1 = Long.rotateLeft(k1, 31);
k1 *= C2;
return k1;
}
Reported by PMD.
Line: 200
return k;
}
private static long mixK1(long k1) {
k1 *= C1;
k1 = Long.rotateLeft(k1, 31);
k1 *= C2;
return k1;
}
Reported by PMD.
Line: 207
return k1;
}
private static long mixK2(long k2) {
k2 *= C2;
k2 = Long.rotateLeft(k2, 33);
k2 *= C1;
return k2;
}
Reported by PMD.
Line: 207
return k1;
}
private static long mixK2(long k2) {
k2 *= C2;
k2 = Long.rotateLeft(k2, 33);
k2 *= C1;
return k2;
}
Reported by PMD.
guava/src/com/google/common/collect/ForwardingTable.java
22 issues
Line: 39
@ElementTypesAreNonnullByDefault
public abstract class ForwardingTable<
R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object>
extends ForwardingObject implements Table<R, C, V> {
/** Constructor for use by subclasses. */
protected ForwardingTable() {}
@Override
protected abstract Table<R, C, V> delegate();
Reported by PMD.
Line: 48
@Override
public Set<Cell<R, C, V>> cellSet() {
return delegate().cellSet();
}
@Override
public void clear() {
delegate().clear();
Reported by PMD.
Line: 53
@Override
public void clear() {
delegate().clear();
}
@Override
public Map<R, V> column(@ParametricNullness C columnKey) {
return delegate().column(columnKey);
Reported by PMD.
Line: 58
@Override
public Map<R, V> column(@ParametricNullness C columnKey) {
return delegate().column(columnKey);
}
@Override
public Set<C> columnKeySet() {
return delegate().columnKeySet();
Reported by PMD.
Line: 63
@Override
public Set<C> columnKeySet() {
return delegate().columnKeySet();
}
@Override
public Map<C, Map<R, V>> columnMap() {
return delegate().columnMap();
Reported by PMD.
Line: 68
@Override
public Map<C, Map<R, V>> columnMap() {
return delegate().columnMap();
}
@Override
public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
return delegate().contains(rowKey, columnKey);
Reported by PMD.
Line: 73
@Override
public boolean contains(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
return delegate().contains(rowKey, columnKey);
}
@Override
public boolean containsColumn(@CheckForNull Object columnKey) {
return delegate().containsColumn(columnKey);
Reported by PMD.
Line: 78
@Override
public boolean containsColumn(@CheckForNull Object columnKey) {
return delegate().containsColumn(columnKey);
}
@Override
public boolean containsRow(@CheckForNull Object rowKey) {
return delegate().containsRow(rowKey);
Reported by PMD.
Line: 83
@Override
public boolean containsRow(@CheckForNull Object rowKey) {
return delegate().containsRow(rowKey);
}
@Override
public boolean containsValue(@CheckForNull Object value) {
return delegate().containsValue(value);
Reported by PMD.
Line: 88
@Override
public boolean containsValue(@CheckForNull Object value) {
return delegate().containsValue(value);
}
@Override
@CheckForNull
public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
Reported by PMD.
guava/src/com/google/common/collect/ImmutableTable.java
22 issues
Line: 50
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V>
implements Serializable {
/**
* Returns a {@code Collector} that accumulates elements into an {@code ImmutableTable}. Each
* input element is mapped to one cell in the returned table, with the rows, columns, and values
Reported by PMD.
Line: 51
@GwtCompatible
@ElementTypesAreNonnullByDefault
public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V>
implements Serializable {
/**
* Returns a {@code Collector} that accumulates elements into an {@code ImmutableTable}. Each
* input element is mapped to one cell in the returned table, with the rows, columns, and values
* generated by applying the specified functions.
Reported by PMD.
Line: 187
*/
@DoNotMock
public static final class Builder<R, C, V> {
private final List<Cell<R, C, V>> cells = Lists.newArrayList();
@CheckForNull private Comparator<? super R> rowComparator;
@CheckForNull private Comparator<? super C> columnComparator;
/**
* Creates a new builder. The returned builder is equivalent to the builder generated by {@link
Reported by PMD.
Line: 188
@DoNotMock
public static final class Builder<R, C, V> {
private final List<Cell<R, C, V>> cells = Lists.newArrayList();
@CheckForNull private Comparator<? super R> rowComparator;
@CheckForNull private Comparator<? super C> columnComparator;
/**
* Creates a new builder. The returned builder is equivalent to the builder generated by {@link
* ImmutableTable#builder}.
Reported by PMD.
Line: 189
public static final class Builder<R, C, V> {
private final List<Cell<R, C, V>> cells = Lists.newArrayList();
@CheckForNull private Comparator<? super R> rowComparator;
@CheckForNull private Comparator<? super C> columnComparator;
/**
* Creates a new builder. The returned builder is equivalent to the builder generated by {@link
* ImmutableTable#builder}.
*/
Reported by PMD.
Line: 320
public ImmutableMap<R, V> column(C columnKey) {
checkNotNull(columnKey, "columnKey");
return MoreObjects.firstNonNull(
(ImmutableMap<R, V>) columnMap().get(columnKey), ImmutableMap.<R, V>of());
}
@Override
public ImmutableSet<C> columnKeySet() {
return columnMap().keySet();
Reported by PMD.
Line: 325
@Override
public ImmutableSet<C> columnKeySet() {
return columnMap().keySet();
}
/**
* {@inheritDoc}
*
Reported by PMD.
Line: 346
public ImmutableMap<C, V> row(R rowKey) {
checkNotNull(rowKey, "rowKey");
return MoreObjects.firstNonNull(
(ImmutableMap<C, V>) rowMap().get(rowKey), ImmutableMap.<C, V>of());
}
@Override
public ImmutableSet<R> rowKeySet() {
return rowMap().keySet();
Reported by PMD.
Line: 351
@Override
public ImmutableSet<R> rowKeySet() {
return rowMap().keySet();
}
/**
* {@inheritDoc}
*
Reported by PMD.
Line: 370
@Override
public boolean containsValue(@CheckForNull Object value) {
return values().contains(value);
}
/**
* Guaranteed to throw an exception and leave the table unmodified.
*
Reported by PMD.
guava-tests/test/com/google/common/base/CharsetsTest.java
22 issues
Line: 33
@GwtCompatible(emulated = true)
public class CharsetsTest extends TestCase {
@GwtIncompatible // Non-UTF-8 Charset
public void testUsAscii() {
assertEquals(Charset.forName("US-ASCII"), Charsets.US_ASCII);
}
@GwtIncompatible // Non-UTF-8 Charset
Reported by PMD.
Line: 35
@GwtIncompatible // Non-UTF-8 Charset
public void testUsAscii() {
assertEquals(Charset.forName("US-ASCII"), Charsets.US_ASCII);
}
@GwtIncompatible // Non-UTF-8 Charset
public void testIso88591() {
assertEquals(Charset.forName("ISO-8859-1"), Charsets.ISO_8859_1);
Reported by PMD.
Line: 38
assertEquals(Charset.forName("US-ASCII"), Charsets.US_ASCII);
}
@GwtIncompatible // Non-UTF-8 Charset
public void testIso88591() {
assertEquals(Charset.forName("ISO-8859-1"), Charsets.ISO_8859_1);
}
public void testUtf8() {
Reported by PMD.
Line: 40
@GwtIncompatible // Non-UTF-8 Charset
public void testIso88591() {
assertEquals(Charset.forName("ISO-8859-1"), Charsets.ISO_8859_1);
}
public void testUtf8() {
assertEquals(Charset.forName("UTF-8"), Charsets.UTF_8);
}
Reported by PMD.
Line: 43
assertEquals(Charset.forName("ISO-8859-1"), Charsets.ISO_8859_1);
}
public void testUtf8() {
assertEquals(Charset.forName("UTF-8"), Charsets.UTF_8);
}
@GwtIncompatible // Non-UTF-8 Charset
public void testUtf16be() {
Reported by PMD.
Line: 44
}
public void testUtf8() {
assertEquals(Charset.forName("UTF-8"), Charsets.UTF_8);
}
@GwtIncompatible // Non-UTF-8 Charset
public void testUtf16be() {
assertEquals(Charset.forName("UTF-16BE"), Charsets.UTF_16BE);
Reported by PMD.
Line: 47
assertEquals(Charset.forName("UTF-8"), Charsets.UTF_8);
}
@GwtIncompatible // Non-UTF-8 Charset
public void testUtf16be() {
assertEquals(Charset.forName("UTF-16BE"), Charsets.UTF_16BE);
}
@GwtIncompatible // Non-UTF-8 Charset
Reported by PMD.
Line: 49
@GwtIncompatible // Non-UTF-8 Charset
public void testUtf16be() {
assertEquals(Charset.forName("UTF-16BE"), Charsets.UTF_16BE);
}
@GwtIncompatible // Non-UTF-8 Charset
public void testUtf16le() {
assertEquals(Charset.forName("UTF-16LE"), Charsets.UTF_16LE);
Reported by PMD.
Line: 52
assertEquals(Charset.forName("UTF-16BE"), Charsets.UTF_16BE);
}
@GwtIncompatible // Non-UTF-8 Charset
public void testUtf16le() {
assertEquals(Charset.forName("UTF-16LE"), Charsets.UTF_16LE);
}
@GwtIncompatible // Non-UTF-8 Charset
Reported by PMD.
Line: 54
@GwtIncompatible // Non-UTF-8 Charset
public void testUtf16le() {
assertEquals(Charset.forName("UTF-16LE"), Charsets.UTF_16LE);
}
@GwtIncompatible // Non-UTF-8 Charset
public void testUtf16() {
assertEquals(Charset.forName("UTF-16"), Charsets.UTF_16);
Reported by PMD.
guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java
22 issues
Line: 32
abstract Iterable<ImmutableTable<Character, Integer, String>> getTestInstances();
public final void testClear() {
for (Table<Character, Integer, String> testInstance : getTestInstances()) {
try {
testInstance.clear();
fail();
} catch (UnsupportedOperationException e) {
Reported by PMD.
Line: 36
for (Table<Character, Integer, String> testInstance : getTestInstances()) {
try {
testInstance.clear();
fail();
} catch (UnsupportedOperationException e) {
// success
}
}
}
Reported by PMD.
Line: 36
for (Table<Character, Integer, String> testInstance : getTestInstances()) {
try {
testInstance.clear();
fail();
} catch (UnsupportedOperationException e) {
// success
}
}
}
Reported by PMD.
Line: 37
try {
testInstance.clear();
fail();
} catch (UnsupportedOperationException e) {
// success
}
}
}
Reported by PMD.
Line: 43
}
}
public final void testPut() {
for (Table<Character, Integer, String> testInstance : getTestInstances()) {
try {
testInstance.put('a', 1, "blah");
fail();
} catch (UnsupportedOperationException e) {
Reported by PMD.
Line: 47
for (Table<Character, Integer, String> testInstance : getTestInstances()) {
try {
testInstance.put('a', 1, "blah");
fail();
} catch (UnsupportedOperationException e) {
// success
}
}
}
Reported by PMD.
Line: 47
for (Table<Character, Integer, String> testInstance : getTestInstances()) {
try {
testInstance.put('a', 1, "blah");
fail();
} catch (UnsupportedOperationException e) {
// success
}
}
}
Reported by PMD.
Line: 48
try {
testInstance.put('a', 1, "blah");
fail();
} catch (UnsupportedOperationException e) {
// success
}
}
}
Reported by PMD.
Line: 54
}
}
public final void testPutAll() {
for (Table<Character, Integer, String> testInstance : getTestInstances()) {
try {
testInstance.putAll(ImmutableTable.of('a', 1, "blah"));
fail();
} catch (UnsupportedOperationException e) {
Reported by PMD.
Line: 58
for (Table<Character, Integer, String> testInstance : getTestInstances()) {
try {
testInstance.putAll(ImmutableTable.of('a', 1, "blah"));
fail();
} catch (UnsupportedOperationException e) {
// success
}
}
}
Reported by PMD.
guava-tests/test/com/google/common/hash/HashingOutputStreamTest.java
22 issues
Line: 32
* @author Nick Piepmeier
*/
public class HashingOutputStreamTest extends TestCase {
private Hasher hasher;
private HashFunction hashFunction;
private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@SuppressWarnings("DoNotMock")
@Override
Reported by PMD.
Line: 33
*/
public class HashingOutputStreamTest extends TestCase {
private Hasher hasher;
private HashFunction hashFunction;
private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@SuppressWarnings("DoNotMock")
@Override
protected void setUp() throws Exception {
Reported by PMD.
Line: 34
public class HashingOutputStreamTest extends TestCase {
private Hasher hasher;
private HashFunction hashFunction;
private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@SuppressWarnings("DoNotMock")
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 36
private HashFunction hashFunction;
private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
@SuppressWarnings("DoNotMock")
@Override
protected void setUp() throws Exception {
super.setUp();
hasher = mock(Hasher.class);
hashFunction = mock(HashFunction.class);
Reported by PMD.
Line: 43
hasher = mock(Hasher.class);
hashFunction = mock(HashFunction.class);
when(hashFunction.newHasher()).thenReturn(hasher);
}
public void testWrite_putSingleByte() throws Exception {
int b = 'q';
HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
Reported by PMD.
Line: 46
when(hashFunction.newHasher()).thenReturn(hasher);
}
public void testWrite_putSingleByte() throws Exception {
int b = 'q';
HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
out.write(b);
verify(hashFunction).newHasher();
Reported by PMD.
Line: 48
public void testWrite_putSingleByte() throws Exception {
int b = 'q';
HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
out.write(b);
verify(hashFunction).newHasher();
verify(hasher).putByte((byte) b);
verifyNoMoreInteractions(hashFunction, hasher);
Reported by PMD.
Line: 51
HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
out.write(b);
verify(hashFunction).newHasher();
verify(hasher).putByte((byte) b);
verifyNoMoreInteractions(hashFunction, hasher);
}
public void testWrite_putByteArray() throws Exception {
Reported by PMD.
Line: 56
verifyNoMoreInteractions(hashFunction, hasher);
}
public void testWrite_putByteArray() throws Exception {
byte[] buf = new byte[] {'y', 'a', 'm', 's'};
HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
out.write(buf);
verify(hashFunction).newHasher();
Reported by PMD.
Line: 58
public void testWrite_putByteArray() throws Exception {
byte[] buf = new byte[] {'y', 'a', 'm', 's'};
HashingOutputStream out = new HashingOutputStream(hashFunction, buffer);
out.write(buf);
verify(hashFunction).newHasher();
verify(hasher).putBytes(buf, 0, buf.length);
verifyNoMoreInteractions(hashFunction, hasher);
Reported by PMD.
guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java
22 issues
Line: 29
* @author Gregory Kick
*/
@GwtCompatible(emulated = true)
public class EmptyImmutableTableTest extends AbstractImmutableTableTest {
private static final ImmutableTable<Character, Integer, String> INSTANCE = ImmutableTable.of();
@Override
Iterable<ImmutableTable<Character, Integer, String>> getTestInstances() {
return ImmutableSet.of(INSTANCE);
Reported by PMD.
Line: 37
return ImmutableSet.of(INSTANCE);
}
public void testHashCode() {
assertEquals(0, INSTANCE.hashCode());
}
public void testEqualsObject() {
Table<Character, Integer, String> nonEmptyTable = HashBasedTable.create();
Reported by PMD.
Line: 41
assertEquals(0, INSTANCE.hashCode());
}
public void testEqualsObject() {
Table<Character, Integer, String> nonEmptyTable = HashBasedTable.create();
nonEmptyTable.put('A', 1, "blah");
new EqualsTester()
.addEqualityGroup(INSTANCE, HashBasedTable.create(), TreeBasedTable.create())
Reported by PMD.
Line: 43
public void testEqualsObject() {
Table<Character, Integer, String> nonEmptyTable = HashBasedTable.create();
nonEmptyTable.put('A', 1, "blah");
new EqualsTester()
.addEqualityGroup(INSTANCE, HashBasedTable.create(), TreeBasedTable.create())
.addEqualityGroup(nonEmptyTable)
.testEquals();
Reported by PMD.
Line: 51
.testEquals();
}
@GwtIncompatible // ArrayTable
public void testEqualsObjectNullValues() {
new EqualsTester()
.addEqualityGroup(INSTANCE)
.addEqualityGroup(ArrayTable.create(ImmutableSet.of('A'), ImmutableSet.of(1)))
.testEquals();
Reported by PMD.
Line: 59
.testEquals();
}
public void testToString() {
assertEquals("{}", INSTANCE.toString());
}
public void testSize() {
assertEquals(0, INSTANCE.size());
Reported by PMD.
Line: 63
assertEquals("{}", INSTANCE.toString());
}
public void testSize() {
assertEquals(0, INSTANCE.size());
}
public void testGet() {
assertNull(INSTANCE.get('a', 1));
Reported by PMD.
Line: 67
assertEquals(0, INSTANCE.size());
}
public void testGet() {
assertNull(INSTANCE.get('a', 1));
}
public void testIsEmpty() {
assertTrue(INSTANCE.isEmpty());
Reported by PMD.
Line: 71
assertNull(INSTANCE.get('a', 1));
}
public void testIsEmpty() {
assertTrue(INSTANCE.isEmpty());
}
public void testCellSet() {
assertEquals(ImmutableSet.of(), INSTANCE.cellSet());
Reported by PMD.
Line: 75
assertTrue(INSTANCE.isEmpty());
}
public void testCellSet() {
assertEquals(ImmutableSet.of(), INSTANCE.cellSet());
}
public void testColumn() {
assertEquals(ImmutableMap.of(), INSTANCE.column(1));
Reported by PMD.
guava-tests/test/com/google/common/collect/SynchronizedSetTest.java
22 issues
Line: 39
*/
public class SynchronizedSetTest extends TestCase {
public static final Object MUTEX = new Integer(1); // something Serializable
public static Test suite() {
return SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
Reported by PMD.
Line: 37
*
* @author Mike Bostock
*/
public class SynchronizedSetTest extends TestCase {
public static final Object MUTEX = new Integer(1); // something Serializable
public static Test suite() {
return SetTestSuiteBuilder.using(
Reported by PMD.
Line: 41
public static final Object MUTEX = new Integer(1); // something Serializable
public static Test suite() {
return SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
TestSet<String> inner = new TestSet<>(new HashSet<String>(), null);
Reported by PMD.
Line: 62
.createTestSuite();
}
static class TestSet<E> extends ForwardingSet<E> implements Serializable {
final Set<E> delegate;
public Object mutex;
public TestSet(Set<E> delegate, Object mutex) {
this.delegate = delegate;
Reported by PMD.
Line: 63
}
static class TestSet<E> extends ForwardingSet<E> implements Serializable {
final Set<E> delegate;
public Object mutex;
public TestSet(Set<E> delegate, Object mutex) {
this.delegate = delegate;
this.mutex = mutex;
Reported by PMD.
Line: 63
}
static class TestSet<E> extends ForwardingSet<E> implements Serializable {
final Set<E> delegate;
public Object mutex;
public TestSet(Set<E> delegate, Object mutex) {
this.delegate = delegate;
this.mutex = mutex;
Reported by PMD.
Line: 64
static class TestSet<E> extends ForwardingSet<E> implements Serializable {
final Set<E> delegate;
public Object mutex;
public TestSet(Set<E> delegate, Object mutex) {
this.delegate = delegate;
this.mutex = mutex;
}
Reported by PMD.
Line: 78
@Override
public String toString() {
assertTrue(Thread.holdsLock(mutex));
return super.toString();
}
@Override
public boolean equals(@Nullable Object o) {
Reported by PMD.
Line: 84
@Override
public boolean equals(@Nullable Object o) {
assertTrue(Thread.holdsLock(mutex));
return super.equals(o);
}
@Override
public int hashCode() {
Reported by PMD.
Line: 90
@Override
public int hashCode() {
assertTrue(Thread.holdsLock(mutex));
return super.hashCode();
}
@Override
public boolean add(@Nullable E o) {
Reported by PMD.
guava-tests/benchmark/com/google/common/io/BaseEncodingBenchmark.java
22 issues
Line: 46
}
}
@Param EncodingOption encoding;
@Param({"10", "100", "10000"})
int n;
private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];
Reported by PMD.
Line: 49
@Param EncodingOption encoding;
@Param({"10", "100", "10000"})
int n;
private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];
private final String[] decodingInputs = new String[INPUTS_COUNT];
@BeforeExperiment
Reported by PMD.
Line: 51
@Param({"10", "100", "10000"})
int n;
private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];
private final String[] decodingInputs = new String[INPUTS_COUNT];
@BeforeExperiment
public void setUp() {
Random rng = new Random();
Reported by PMD.
Line: 52
int n;
private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];
private final String[] decodingInputs = new String[INPUTS_COUNT];
@BeforeExperiment
public void setUp() {
Random rng = new Random();
for (int i = 0; i < encodingInputs.length; i++) {
Reported by PMD.
Line: 54
private final byte[][] encodingInputs = new byte[INPUTS_COUNT][];
private final String[] decodingInputs = new String[INPUTS_COUNT];
@BeforeExperiment
public void setUp() {
Random rng = new Random();
for (int i = 0; i < encodingInputs.length; i++) {
encodingInputs[i] = new byte[n];
rng.nextBytes(encodingInputs[i]);
Reported by PMD.
Line: 60
for (int i = 0; i < encodingInputs.length; i++) {
encodingInputs[i] = new byte[n];
rng.nextBytes(encodingInputs[i]);
decodingInputs[i] = encoding.encoding.encode(encodingInputs[i]);
}
}
@Benchmark
public int encode(int reps) {
Reported by PMD.
Line: 68
public int encode(int reps) {
int tmp = 0;
for (int i = 0; i < reps; i++) {
tmp += System.identityHashCode(encoding.encoding.encode(encodingInputs[i & INPUTS_MASK]));
}
return tmp;
}
@Benchmark
Reported by PMD.
Line: 77
public int decode(int reps) {
int tmp = 0;
for (int i = 0; i < reps; i++) {
tmp += System.identityHashCode(encoding.encoding.decode(decodingInputs[i & INPUTS_MASK]));
}
return tmp;
}
@Benchmark
Reported by PMD.
Line: 86
public int encodingStream(int reps) throws IOException {
int tmp = 0;
for (int i = 0; i < reps; i++) {
StringWriter target = new StringWriter(2 * n);
OutputStream encodingStream = encoding.encoding.encodingStream(target);
encodingStream.write(encodingInputs[i & INPUTS_MASK]);
encodingStream.close();
tmp += target.getBuffer().length();
}
Reported by PMD.
Line: 87
int tmp = 0;
for (int i = 0; i < reps; i++) {
StringWriter target = new StringWriter(2 * n);
OutputStream encodingStream = encoding.encoding.encodingStream(target);
encodingStream.write(encodingInputs[i & INPUTS_MASK]);
encodingStream.close();
tmp += target.getBuffer().length();
}
return tmp;
Reported by PMD.