The following issues were found
guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java
9 issues
Line: 133
}
}
private abstract static class TestUnhashableListGenerator
extends TestUnhashableCollectionGenerator<List<UnhashableObject>>
implements TestListGenerator<UnhashableObject> {}
public static class UnhashableElementsImmutableListGenerator extends TestUnhashableListGenerator {
@Override
Reported by PMD.
Line: 40
* @author Hayward Chan
*/
@GwtCompatible
public final class ListGenerators {
private ListGenerators() {}
public static class ImmutableListOfGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 65
public static class BuilderAddAllListGenerator extends TestStringListGenerator {
@Override
protected List<String> create(String[] elements) {
return ImmutableList.<String>builder().addAll(asList(elements)).build();
}
}
public static class BuilderReversedListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 65
public static class BuilderAddAllListGenerator extends TestStringListGenerator {
@Override
protected List<String> create(String[] elements) {
return ImmutableList.<String>builder().addAll(asList(elements)).build();
}
}
public static class BuilderReversedListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 65
public static class BuilderAddAllListGenerator extends TestStringListGenerator {
@Override
protected List<String> create(String[] elements) {
return ImmutableList.<String>builder().addAll(asList(elements)).build();
}
}
public static class BuilderReversedListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 74
protected List<String> create(String[] elements) {
List<String> list = asList(elements);
Collections.reverse(list);
return ImmutableList.copyOf(list).reverse();
}
}
public static class ImmutableListHeadSubListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 85
String[] all = new String[elements.length + suffix.length];
System.arraycopy(elements, 0, all, 0, elements.length);
System.arraycopy(suffix, 0, all, elements.length, suffix.length);
return ImmutableList.copyOf(all).subList(0, elements.length);
}
}
public static class ImmutableListTailSubListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 96
String[] all = new String[elements.length + prefix.length];
System.arraycopy(prefix, 0, all, 0, 2);
System.arraycopy(elements, 0, all, 2, elements.length);
return ImmutableList.copyOf(all).subList(2, elements.length + 2);
}
}
public static class ImmutableListMiddleSubListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 111
System.arraycopy(elements, 0, all, 2, elements.length);
System.arraycopy(suffix, 0, all, 2 + elements.length, 2);
return ImmutableList.copyOf(all).subList(2, elements.length + 2);
}
}
public static class CharactersOfStringGenerator extends TestCharacterListGenerator {
@Override
Reported by PMD.
android/guava/src/com/google/common/collect/MapMaker.java
9 issues
Line: 97
static final int UNSET_INT = -1;
// TODO(kevinb): dispense with this after benchmarking
boolean useCustomMap;
int initialCapacity = UNSET_INT;
int concurrencyLevel = UNSET_INT;
@CheckForNull Strength keyStrength;
Reported by PMD.
Line: 99
// TODO(kevinb): dispense with this after benchmarking
boolean useCustomMap;
int initialCapacity = UNSET_INT;
int concurrencyLevel = UNSET_INT;
@CheckForNull Strength keyStrength;
@CheckForNull Strength valueStrength;
Reported by PMD.
Line: 99
// TODO(kevinb): dispense with this after benchmarking
boolean useCustomMap;
int initialCapacity = UNSET_INT;
int concurrencyLevel = UNSET_INT;
@CheckForNull Strength keyStrength;
@CheckForNull Strength valueStrength;
Reported by PMD.
Line: 100
boolean useCustomMap;
int initialCapacity = UNSET_INT;
int concurrencyLevel = UNSET_INT;
@CheckForNull Strength keyStrength;
@CheckForNull Strength valueStrength;
@CheckForNull Equivalence<Object> keyEquivalence;
Reported by PMD.
Line: 100
boolean useCustomMap;
int initialCapacity = UNSET_INT;
int concurrencyLevel = UNSET_INT;
@CheckForNull Strength keyStrength;
@CheckForNull Strength valueStrength;
@CheckForNull Equivalence<Object> keyEquivalence;
Reported by PMD.
Line: 105
@CheckForNull Strength keyStrength;
@CheckForNull Strength valueStrength;
@CheckForNull Equivalence<Object> keyEquivalence;
/**
* Constructs a new {@code MapMaker} instance with default settings, including strong keys, strong
* values, and no automatic eviction of any kind.
*/
Reported by PMD.
Line: 105
@CheckForNull Strength keyStrength;
@CheckForNull Strength valueStrength;
@CheckForNull Equivalence<Object> keyEquivalence;
/**
* Constructs a new {@code MapMaker} instance with default settings, including strong keys, strong
* values, and no automatic eviction of any kind.
*/
Reported by PMD.
Line: 130
}
Equivalence<Object> getKeyEquivalence() {
return MoreObjects.firstNonNull(keyEquivalence, getKeyStrength().defaultEquivalence());
}
/**
* Sets the minimum total size for the internal hash tables. For example, if the initial capacity
* is {@code 60}, and the concurrency level is {@code 8}, then eight segments are created, each
Reported by PMD.
Line: 309
if (keyEquivalence != null) {
s.addValue("keyEquivalence");
}
return s.toString();
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/io/ByteSinkTester.java
9 issues
Line: 69
String name, ByteSinkFactory factory, String desc, byte[] bytes) {
TestSuite suite = new TestSuite(name + " [" + desc + "]");
for (final Method method : testMethods) {
suite.addTest(new ByteSinkTester(factory, bytes, name, desc, method));
}
return suite;
}
private ByteSink sink;
Reported by PMD.
Line: 74
return suite;
}
private ByteSink sink;
ByteSinkTester(
ByteSinkFactory factory, byte[] data, String suiteName, String caseDesc, Method method) {
super(factory, data, suiteName, caseDesc, method);
}
Reported by PMD.
Line: 81
super(factory, data, suiteName, caseDesc, method);
}
@Override
protected void setUp() throws Exception {
sink = factory.createSink();
}
public void testOpenStream() throws IOException {
Reported by PMD.
Line: 86
sink = factory.createSink();
}
public void testOpenStream() throws IOException {
OutputStream out = sink.openStream();
try {
ByteStreams.copy(new ByteArrayInputStream(data), out);
} finally {
out.close();
Reported by PMD.
Line: 88
public void testOpenStream() throws IOException {
OutputStream out = sink.openStream();
try {
ByteStreams.copy(new ByteArrayInputStream(data), out);
} finally {
out.close();
}
Reported by PMD.
Line: 97
assertContainsExpectedBytes();
}
public void testOpenBufferedStream() throws IOException {
OutputStream out = sink.openBufferedStream();
try {
ByteStreams.copy(new ByteArrayInputStream(data), out);
} finally {
out.close();
Reported by PMD.
Line: 99
public void testOpenBufferedStream() throws IOException {
OutputStream out = sink.openBufferedStream();
try {
ByteStreams.copy(new ByteArrayInputStream(data), out);
} finally {
out.close();
}
Reported by PMD.
Line: 108
assertContainsExpectedBytes();
}
public void testWrite() throws IOException {
sink.write(data);
assertContainsExpectedBytes();
}
Reported by PMD.
Line: 114
assertContainsExpectedBytes();
}
public void testWriteFrom_inputStream() throws IOException {
sink.writeFrom(new ByteArrayInputStream(data));
assertContainsExpectedBytes();
}
Reported by PMD.
android/guava-tests/test/com/google/common/graph/StandardMutableUndirectedNetworkTest.java
9 issues
Line: 45
});
}
private final boolean allowsSelfLoops;
private final boolean allowsParallelEdges;
private final ElementOrder<Integer> nodeOrder;
private final ElementOrder<String> edgeOrder;
public StandardMutableUndirectedNetworkTest(
Reported by PMD.
Line: 46
}
private final boolean allowsSelfLoops;
private final boolean allowsParallelEdges;
private final ElementOrder<Integer> nodeOrder;
private final ElementOrder<String> edgeOrder;
public StandardMutableUndirectedNetworkTest(
boolean allowsSelfLoops,
Reported by PMD.
Line: 47
private final boolean allowsSelfLoops;
private final boolean allowsParallelEdges;
private final ElementOrder<Integer> nodeOrder;
private final ElementOrder<String> edgeOrder;
public StandardMutableUndirectedNetworkTest(
boolean allowsSelfLoops,
boolean allowsParallelEdges,
Reported by PMD.
Line: 48
private final boolean allowsSelfLoops;
private final boolean allowsParallelEdges;
private final ElementOrder<Integer> nodeOrder;
private final ElementOrder<String> edgeOrder;
public StandardMutableUndirectedNetworkTest(
boolean allowsSelfLoops,
boolean allowsParallelEdges,
ElementOrder<Integer> nodeOrder,
Reported by PMD.
Line: 63
@Override
MutableNetwork<Integer, String> createGraph() {
return NetworkBuilder.undirected()
.allowsSelfLoops(allowsSelfLoops)
.allowsParallelEdges(allowsParallelEdges)
.nodeOrder(nodeOrder)
.edgeOrder(edgeOrder)
.build();
Reported by PMD.
Line: 63
@Override
MutableNetwork<Integer, String> createGraph() {
return NetworkBuilder.undirected()
.allowsSelfLoops(allowsSelfLoops)
.allowsParallelEdges(allowsParallelEdges)
.nodeOrder(nodeOrder)
.edgeOrder(edgeOrder)
.build();
Reported by PMD.
Line: 63
@Override
MutableNetwork<Integer, String> createGraph() {
return NetworkBuilder.undirected()
.allowsSelfLoops(allowsSelfLoops)
.allowsParallelEdges(allowsParallelEdges)
.nodeOrder(nodeOrder)
.edgeOrder(edgeOrder)
.build();
Reported by PMD.
Line: 63
@Override
MutableNetwork<Integer, String> createGraph() {
return NetworkBuilder.undirected()
.allowsSelfLoops(allowsSelfLoops)
.allowsParallelEdges(allowsParallelEdges)
.nodeOrder(nodeOrder)
.edgeOrder(edgeOrder)
.build();
Reported by PMD.
Line: 63
@Override
MutableNetwork<Integer, String> createGraph() {
return NetworkBuilder.undirected()
.allowsSelfLoops(allowsSelfLoops)
.allowsParallelEdges(allowsParallelEdges)
.nodeOrder(nodeOrder)
.edgeOrder(edgeOrder)
.build();
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/SetTestSuiteBuilder.java
9 issues
Line: 55
protected List<Class<? extends AbstractTester>> getTesters() {
List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
testers.add(CollectionSerializationEqualTester.class);
testers.add(SetAddAllTester.class);
testers.add(SetAddTester.class);
testers.add(SetCreationTester.class);
testers.add(SetHashCodeTester.class);
testers.add(SetEqualsTester.class);
Reported by PMD.
Line: 56
List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
testers.add(CollectionSerializationEqualTester.class);
testers.add(SetAddAllTester.class);
testers.add(SetAddTester.class);
testers.add(SetCreationTester.class);
testers.add(SetHashCodeTester.class);
testers.add(SetEqualsTester.class);
testers.add(SetRemoveTester.class);
Reported by PMD.
Line: 57
testers.add(CollectionSerializationEqualTester.class);
testers.add(SetAddAllTester.class);
testers.add(SetAddTester.class);
testers.add(SetCreationTester.class);
testers.add(SetHashCodeTester.class);
testers.add(SetEqualsTester.class);
testers.add(SetRemoveTester.class);
// SetRemoveAllTester doesn't exist because, Sets not permitting
Reported by PMD.
Line: 58
testers.add(CollectionSerializationEqualTester.class);
testers.add(SetAddAllTester.class);
testers.add(SetAddTester.class);
testers.add(SetCreationTester.class);
testers.add(SetHashCodeTester.class);
testers.add(SetEqualsTester.class);
testers.add(SetRemoveTester.class);
// SetRemoveAllTester doesn't exist because, Sets not permitting
// duplicate elements, there are no tests for Set.removeAll() that aren't
Reported by PMD.
Line: 59
testers.add(SetAddAllTester.class);
testers.add(SetAddTester.class);
testers.add(SetCreationTester.class);
testers.add(SetHashCodeTester.class);
testers.add(SetEqualsTester.class);
testers.add(SetRemoveTester.class);
// SetRemoveAllTester doesn't exist because, Sets not permitting
// duplicate elements, there are no tests for Set.removeAll() that aren't
// covered by CollectionRemoveAllTester.
Reported by PMD.
Line: 60
testers.add(SetAddTester.class);
testers.add(SetCreationTester.class);
testers.add(SetHashCodeTester.class);
testers.add(SetEqualsTester.class);
testers.add(SetRemoveTester.class);
// SetRemoveAllTester doesn't exist because, Sets not permitting
// duplicate elements, there are no tests for Set.removeAll() that aren't
// covered by CollectionRemoveAllTester.
return testers;
Reported by PMD.
Line: 61
testers.add(SetCreationTester.class);
testers.add(SetHashCodeTester.class);
testers.add(SetEqualsTester.class);
testers.add(SetRemoveTester.class);
// SetRemoveAllTester doesn't exist because, Sets not permitting
// duplicate elements, there are no tests for Set.removeAll() that aren't
// covered by CollectionRemoveAllTester.
return testers;
}
Reported by PMD.
Line: 74
parentBuilder) {
List<TestSuite> derivedSuites = new ArrayList<>(super.createDerivedSuites(parentBuilder));
if (parentBuilder.getFeatures().contains(SERIALIZABLE)) {
derivedSuites.add(
SetTestSuiteBuilder.using(
new ReserializedSetGenerator<E>(parentBuilder.getSubjectGenerator()))
.named(getName() + " reserialized")
.withFeatures(computeReserializedCollectionFeatures(parentBuilder.getFeatures()))
Reported by PMD.
Line: 89
}
static class ReserializedSetGenerator<E> implements TestSetGenerator<E> {
final OneSizeTestContainerGenerator<Collection<E>, E> gen;
private ReserializedSetGenerator(OneSizeTestContainerGenerator<Collection<E>, E> gen) {
this.gen = gen;
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java
9 issues
Line: 33
*/
@GwtCompatible
public final class OneSizeGenerator<T, E> implements OneSizeTestContainerGenerator<T, E> {
private final TestContainerGenerator<T, E> generator;
private final CollectionSize collectionSize;
public OneSizeGenerator(TestContainerGenerator<T, E> generator, CollectionSize collectionSize) {
this.generator = generator;
this.collectionSize = collectionSize;
Reported by PMD.
Line: 63
@Override
public T createTestSubject() {
Collection<E> elements = getSampleElements(getCollectionSize().getNumElements());
return generator.create(elements.toArray());
}
@Override
public Collection<E> getSampleElements(int howMany) {
Reported by PMD.
Line: 64
@Override
public T createTestSubject() {
Collection<E> elements = getSampleElements(getCollectionSize().getNumElements());
return generator.create(elements.toArray());
}
@Override
public Collection<E> getSampleElements(int howMany) {
SampleElements<E> samples = samples();
Reported by PMD.
Line: 72
SampleElements<E> samples = samples();
@SuppressWarnings("unchecked")
List<E> allSampleElements =
Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4());
return new ArrayList<E>(allSampleElements.subList(0, howMany));
}
@Override
public CollectionSize getCollectionSize() {
Reported by PMD.
Line: 72
SampleElements<E> samples = samples();
@SuppressWarnings("unchecked")
List<E> allSampleElements =
Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4());
return new ArrayList<E>(allSampleElements.subList(0, howMany));
}
@Override
public CollectionSize getCollectionSize() {
Reported by PMD.
Line: 72
SampleElements<E> samples = samples();
@SuppressWarnings("unchecked")
List<E> allSampleElements =
Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4());
return new ArrayList<E>(allSampleElements.subList(0, howMany));
}
@Override
public CollectionSize getCollectionSize() {
Reported by PMD.
Line: 72
SampleElements<E> samples = samples();
@SuppressWarnings("unchecked")
List<E> allSampleElements =
Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4());
return new ArrayList<E>(allSampleElements.subList(0, howMany));
}
@Override
public CollectionSize getCollectionSize() {
Reported by PMD.
Line: 72
SampleElements<E> samples = samples();
@SuppressWarnings("unchecked")
List<E> allSampleElements =
Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4());
return new ArrayList<E>(allSampleElements.subList(0, howMany));
}
@Override
public CollectionSize getCollectionSize() {
Reported by PMD.
Line: 73
@SuppressWarnings("unchecked")
List<E> allSampleElements =
Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4());
return new ArrayList<E>(allSampleElements.subList(0, howMany));
}
@Override
public CollectionSize getCollectionSize() {
return collectionSize;
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java
9 issues
Line: 34
* @author George van den Driessche
*/
@GwtCompatible
public class AbstractTester<G> extends TestCase {
private G subjectGenerator;
private String suiteName;
private Runnable setUp;
private Runnable tearDown;
Reported by PMD.
Line: 35
*/
@GwtCompatible
public class AbstractTester<G> extends TestCase {
private G subjectGenerator;
private String suiteName;
private Runnable setUp;
private Runnable tearDown;
// public so that it can be referenced in generated GWT tests.
Reported by PMD.
Line: 36
@GwtCompatible
public class AbstractTester<G> extends TestCase {
private G subjectGenerator;
private String suiteName;
private Runnable setUp;
private Runnable tearDown;
// public so that it can be referenced in generated GWT tests.
@Override
Reported by PMD.
Line: 37
public class AbstractTester<G> extends TestCase {
private G subjectGenerator;
private String suiteName;
private Runnable setUp;
private Runnable tearDown;
// public so that it can be referenced in generated GWT tests.
@Override
public void setUp() throws Exception {
Reported by PMD.
Line: 37
public class AbstractTester<G> extends TestCase {
private G subjectGenerator;
private String suiteName;
private Runnable setUp;
private Runnable tearDown;
// public so that it can be referenced in generated GWT tests.
@Override
public void setUp() throws Exception {
Reported by PMD.
Line: 38
private G subjectGenerator;
private String suiteName;
private Runnable setUp;
private Runnable tearDown;
// public so that it can be referenced in generated GWT tests.
@Override
public void setUp() throws Exception {
if (setUp != null) {
Reported by PMD.
Line: 38
private G subjectGenerator;
private String suiteName;
private Runnable setUp;
private Runnable tearDown;
// public so that it can be referenced in generated GWT tests.
@Override
public void setUp() throws Exception {
if (setUp != null) {
Reported by PMD.
Line: 41
private Runnable tearDown;
// public so that it can be referenced in generated GWT tests.
@Override
public void setUp() throws Exception {
if (setUp != null) {
setUp.run();
}
}
Reported by PMD.
Line: 49
}
// public so that it can be referenced in generated GWT tests.
@Override
public void tearDown() throws Exception {
if (tearDown != null) {
tearDown.run();
}
}
Reported by PMD.
android/guava-testlib/test/com/google/common/collect/testing/features/FeatureEnumTest.java
9 issues
Line: 45
assertEquals(
rootLocaleFormat("%s must have RUNTIME RetentionPolicy.", annotationClass),
RetentionPolicy.RUNTIME,
retentionPolicy.value());
assertNotNull(
rootLocaleFormat("%s must be inherited.", annotationClass),
annotationClass.getAnnotation(Inherited.class));
for (String propertyName : new String[] {"value", "absent"}) {
Reported by PMD.
Line: 58
fail(
rootLocaleFormat("%s must have a property named '%s'.", annotationClass, propertyName));
}
final Class<?> returnType = method.getReturnType();
assertTrue(
rootLocaleFormat("%s.%s() must return an array.", annotationClass, propertyName),
returnType.isArray());
assertSame(
rootLocaleFormat(
Reported by PMD.
Line: 61
final Class<?> returnType = method.getReturnType();
assertTrue(
rootLocaleFormat("%s.%s() must return an array.", annotationClass, propertyName),
returnType.isArray());
assertSame(
rootLocaleFormat(
"%s.%s() must return an array of %s.",
annotationClass, propertyName, annotationClass.getDeclaringClass()),
annotationClass.getDeclaringClass(),
Reported by PMD.
Line: 67
"%s.%s() must return an array of %s.",
annotationClass, propertyName, annotationClass.getDeclaringClass()),
annotationClass.getDeclaringClass(),
returnType.getComponentType());
}
}
// This is public so that tests for Feature enums we haven't yet imagined
// can reuse it.
Reported by PMD.
Line: 77
Class<E> featureEnumClass) {
final Class<?>[] classes = featureEnumClass.getDeclaredClasses();
for (Class<?> containedClass : classes) {
if (containedClass.getSimpleName().equals("Require")) {
if (containedClass.isAnnotation()) {
assertGoodTesterAnnotation(asAnnotation(containedClass));
} else {
fail(
rootLocaleFormat(
Reported by PMD.
Line: 77
Class<E> featureEnumClass) {
final Class<?>[] classes = featureEnumClass.getDeclaredClasses();
for (Class<?> containedClass : classes) {
if (containedClass.getSimpleName().equals("Require")) {
if (containedClass.isAnnotation()) {
assertGoodTesterAnnotation(asAnnotation(containedClass));
} else {
fail(
rootLocaleFormat(
Reported by PMD.
Line: 105
}
}
public void testFeatureEnums() throws Exception {
assertGoodFeatureEnum(CollectionFeature.class);
assertGoodFeatureEnum(ListFeature.class);
assertGoodFeatureEnum(SetFeature.class);
assertGoodFeatureEnum(CollectionSize.class);
assertGoodFeatureEnum(MapFeature.class);
Reported by PMD.
Line: 105
}
}
public void testFeatureEnums() throws Exception {
assertGoodFeatureEnum(CollectionFeature.class);
assertGoodFeatureEnum(ListFeature.class);
assertGoodFeatureEnum(SetFeature.class);
assertGoodFeatureEnum(CollectionSize.class);
assertGoodFeatureEnum(MapFeature.class);
Reported by PMD.
Line: 51
annotationClass.getAnnotation(Inherited.class));
for (String propertyName : new String[] {"value", "absent"}) {
Method method = null;
try {
method = annotationClass.getMethod(propertyName);
} catch (NoSuchMethodException e) {
fail(
rootLocaleFormat("%s must have a property named '%s'.", annotationClass, propertyName));
Reported by PMD.
android/guava-tests/benchmark/com/google/common/base/LazyStackTraceBenchmark.java
9 issues
Line: 34
*/
public class LazyStackTraceBenchmark {
@Param({"20", "200", "2000"})
int stackDepth;
@Param({"-1", "3", "15"})
int breakAt;
int recursionCount;
Reported by PMD.
Line: 37
int stackDepth;
@Param({"-1", "3", "15"})
int breakAt;
int recursionCount;
private static final Object duh = new Object();
Reported by PMD.
Line: 39
@Param({"-1", "3", "15"})
int breakAt;
int recursionCount;
private static final Object duh = new Object();
@Param Mode mode;
Reported by PMD.
Line: 43
private static final Object duh = new Object();
@Param Mode mode;
enum Mode {
LAZY_STACK_TRACE {
@Override
List<StackTraceElement> getStackTrace(Throwable t) {
Reported by PMD.
Line: 63
boolean dummy = false;
for (int i = 0; i < reps; i++) {
int f = 0;
Throwable t = new Throwable();
for (StackTraceElement ste : getStackTrace(t)) {
dummy |= ste == duh;
if (f++ == breakAt) {
break;
}
Reported by PMD.
Line: 65
int f = 0;
Throwable t = new Throwable();
for (StackTraceElement ste : getStackTrace(t)) {
dummy |= ste == duh;
if (f++ == breakAt) {
break;
}
}
}
Reported by PMD.
Line: 66
Throwable t = new Throwable();
for (StackTraceElement ste : getStackTrace(t)) {
dummy |= ste == duh;
if (f++ == breakAt) {
break;
}
}
}
return dummy;
Reported by PMD.
Line: 62
boolean timeIt(int reps, int breakAt) {
boolean dummy = false;
for (int i = 0; i < reps; i++) {
int f = 0;
Throwable t = new Throwable();
for (StackTraceElement ste : getStackTrace(t)) {
dummy |= ste == duh;
if (f++ == breakAt) {
break;
Reported by PMD.
Line: 62
boolean timeIt(int reps, int breakAt) {
boolean dummy = false;
for (int i = 0; i < reps; i++) {
int f = 0;
Throwable t = new Throwable();
for (StackTraceElement ste : getStackTrace(t)) {
dummy |= ste == duh;
if (f++ == breakAt) {
break;
Reported by PMD.
android/guava-tests/benchmark/com/google/common/hash/MessageDigestCreationBenchmark.java
9 issues
Line: 42
}
@Benchmark
int getInstance(int reps) throws Exception {
int retValue = 0;
for (int i = 0; i < reps; i++) {
retValue ^= MessageDigest.getInstance(algorithm).getDigestLength();
}
return retValue;
Reported by PMD.
Line: 32
public class MessageDigestCreationBenchmark {
@Param({"MD5", "SHA-1", "SHA-256", "SHA-384", "SHA-512"})
private String algorithm;
private MessageDigest md;
@BeforeExperiment
void setUp() throws Exception {
Reported by PMD.
Line: 34
@Param({"MD5", "SHA-1", "SHA-256", "SHA-384", "SHA-512"})
private String algorithm;
private MessageDigest md;
@BeforeExperiment
void setUp() throws Exception {
md = MessageDigest.getInstance(algorithm);
}
Reported by PMD.
Line: 34
@Param({"MD5", "SHA-1", "SHA-256", "SHA-384", "SHA-512"})
private String algorithm;
private MessageDigest md;
@BeforeExperiment
void setUp() throws Exception {
md = MessageDigest.getInstance(algorithm);
}
Reported by PMD.
Line: 36
private MessageDigest md;
@BeforeExperiment
void setUp() throws Exception {
md = MessageDigest.getInstance(algorithm);
}
@Benchmark
Reported by PMD.
Line: 37
private MessageDigest md;
@BeforeExperiment
void setUp() throws Exception {
md = MessageDigest.getInstance(algorithm);
}
@Benchmark
int getInstance(int reps) throws Exception {
Reported by PMD.
Line: 42
}
@Benchmark
int getInstance(int reps) throws Exception {
int retValue = 0;
for (int i = 0; i < reps; i++) {
retValue ^= MessageDigest.getInstance(algorithm).getDigestLength();
}
return retValue;
Reported by PMD.
Line: 45
int getInstance(int reps) throws Exception {
int retValue = 0;
for (int i = 0; i < reps; i++) {
retValue ^= MessageDigest.getInstance(algorithm).getDigestLength();
}
return retValue;
}
@Benchmark
Reported by PMD.
Line: 51
}
@Benchmark
int clone(int reps) throws Exception {
int retValue = 0;
for (int i = 0; i < reps; i++) {
retValue ^= ((MessageDigest) md.clone()).getDigestLength();
}
return retValue;
Reported by PMD.