The following issues were found
android/guava/src/com/google/common/graph/DirectedGraphConnections.java
74 issues
Line: 54
* @param <V> Value parameter type
*/
@ElementTypesAreNonnullByDefault
final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
/**
* A wrapper class to indicate a node is both a predecessor and successor while still providing
* the successor value.
*/
private static final class PredAndSucc {
Reported by PMD.
Line: 54
* @param <V> Value parameter type
*/
@ElementTypesAreNonnullByDefault
final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
/**
* A wrapper class to indicate a node is both a predecessor and successor while still providing
* the successor value.
*/
private static final class PredAndSucc {
Reported by PMD.
Line: 54
* @param <V> Value parameter type
*/
@ElementTypesAreNonnullByDefault
final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
/**
* A wrapper class to indicate a node is both a predecessor and successor while still providing
* the successor value.
*/
private static final class PredAndSucc {
Reported by PMD.
Line: 60
* the successor value.
*/
private static final class PredAndSucc {
private final Object successorValue;
PredAndSucc(Object successorValue) {
this.successorValue = successorValue;
}
}
Reported by PMD.
Line: 73
* <p>There can be two types of connections (predecessor and successor), which is represented by
* the two implementations.
*/
private abstract static class NodeConnection<N> {
final N node;
NodeConnection(N node) {
this.node = checkNotNull(node);
}
Reported by PMD.
Line: 74
* the two implementations.
*/
private abstract static class NodeConnection<N> {
final N node;
NodeConnection(N node) {
this.node = checkNotNull(node);
}
Reported by PMD.
Line: 127
// Every value in this map must either be an instance of PredAndSucc with a successorValue of
// type V, PRED (representing predecessor), or an instance of type V (representing successor).
private final Map<N, Object> adjacentNodeValues;
/**
* All node connections in this graph, in edge insertion order.
*
* <p>Note: This field and {@link #adjacentNodeValues} cannot be combined into a single
Reported by PMD.
Line: 137
* LinkedHashMap combines two such edges into a single node-value pair, even though the edges may
* not have been inserted consecutively.
*/
@CheckForNull private final List<NodeConnection<N>> orderedNodeConnections;
private int predecessorCount;
private int successorCount;
private DirectedGraphConnections(
Reported by PMD.
Line: 139
*/
@CheckForNull private final List<NodeConnection<N>> orderedNodeConnections;
private int predecessorCount;
private int successorCount;
private DirectedGraphConnections(
Map<N, Object> adjacentNodeValues,
@CheckForNull List<NodeConnection<N>> orderedNodeConnections,
Reported by PMD.
Line: 140
@CheckForNull private final List<NodeConnection<N>> orderedNodeConnections;
private int predecessorCount;
private int successorCount;
private DirectedGraphConnections(
Map<N, Object> adjacentNodeValues,
@CheckForNull List<NodeConnection<N>> orderedNodeConnections,
int predecessorCount,
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java
74 issues
Line: 47
* @author Justin T. Sampson
*/
public class GeneratedMonitorTest extends TestCase {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
Method[] methods = Monitor.class.getMethods();
Reported by PMD.
Line: 47
* @author Justin T. Sampson
*/
public class GeneratedMonitorTest extends TestCase {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
Method[] methods = Monitor.class.getMethods();
Reported by PMD.
Line: 47
* @author Justin T. Sampson
*/
public class GeneratedMonitorTest extends TestCase {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
Method[] methods = Monitor.class.getMethods();
Reported by PMD.
Line: 47
* @author Justin T. Sampson
*/
public class GeneratedMonitorTest extends TestCase {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
Method[] methods = Monitor.class.getMethods();
Reported by PMD.
Line: 47
* @author Justin T. Sampson
*/
public class GeneratedMonitorTest extends TestCase {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
Method[] methods = Monitor.class.getMethods();
Reported by PMD.
Line: 61
}
}
assertEquals(548, suite.testCount());
return suite;
}
/** A typical timeout value we'll use in the tests. */
Reported by PMD.
Line: 96
@Override
public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
}
}
/** Timeout values to combine with each {@link Scenario}. */
private enum Timeout {
Reported by PMD.
Line: 156
@Override
public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
}
}
/** Identifies all enterXxx and tryEnterXxx methods. */
private static boolean isAnyEnter(Method method) {
Reported by PMD.
Line: 162
/** Identifies all enterXxx and tryEnterXxx methods. */
private static boolean isAnyEnter(Method method) {
return method.getName().startsWith("enter") || method.getName().startsWith("tryEnter");
}
/** Identifies just tryEnterXxx methods (a subset of {@link #isAnyEnter}), which never block. */
private static boolean isTryEnter(Method method) {
return method.getName().startsWith("tryEnter");
Reported by PMD.
Line: 162
/** Identifies all enterXxx and tryEnterXxx methods. */
private static boolean isAnyEnter(Method method) {
return method.getName().startsWith("enter") || method.getName().startsWith("tryEnter");
}
/** Identifies just tryEnterXxx methods (a subset of {@link #isAnyEnter}), which never block. */
private static boolean isTryEnter(Method method) {
return method.getName().startsWith("tryEnter");
Reported by PMD.
guava/src/com/google/common/graph/DirectedGraphConnections.java
74 issues
Line: 54
* @param <V> Value parameter type
*/
@ElementTypesAreNonnullByDefault
final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
/**
* A wrapper class to indicate a node is both a predecessor and successor while still providing
* the successor value.
*/
private static final class PredAndSucc {
Reported by PMD.
Line: 54
* @param <V> Value parameter type
*/
@ElementTypesAreNonnullByDefault
final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
/**
* A wrapper class to indicate a node is both a predecessor and successor while still providing
* the successor value.
*/
private static final class PredAndSucc {
Reported by PMD.
Line: 54
* @param <V> Value parameter type
*/
@ElementTypesAreNonnullByDefault
final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
/**
* A wrapper class to indicate a node is both a predecessor and successor while still providing
* the successor value.
*/
private static final class PredAndSucc {
Reported by PMD.
Line: 60
* the successor value.
*/
private static final class PredAndSucc {
private final Object successorValue;
PredAndSucc(Object successorValue) {
this.successorValue = successorValue;
}
}
Reported by PMD.
Line: 73
* <p>There can be two types of connections (predecessor and successor), which is represented by
* the two implementations.
*/
private abstract static class NodeConnection<N> {
final N node;
NodeConnection(N node) {
this.node = checkNotNull(node);
}
Reported by PMD.
Line: 74
* the two implementations.
*/
private abstract static class NodeConnection<N> {
final N node;
NodeConnection(N node) {
this.node = checkNotNull(node);
}
Reported by PMD.
Line: 127
// Every value in this map must either be an instance of PredAndSucc with a successorValue of
// type V, PRED (representing predecessor), or an instance of type V (representing successor).
private final Map<N, Object> adjacentNodeValues;
/**
* All node connections in this graph, in edge insertion order.
*
* <p>Note: This field and {@link #adjacentNodeValues} cannot be combined into a single
Reported by PMD.
Line: 137
* LinkedHashMap combines two such edges into a single node-value pair, even though the edges may
* not have been inserted consecutively.
*/
@CheckForNull private final List<NodeConnection<N>> orderedNodeConnections;
private int predecessorCount;
private int successorCount;
private DirectedGraphConnections(
Reported by PMD.
Line: 139
*/
@CheckForNull private final List<NodeConnection<N>> orderedNodeConnections;
private int predecessorCount;
private int successorCount;
private DirectedGraphConnections(
Map<N, Object> adjacentNodeValues,
@CheckForNull List<NodeConnection<N>> orderedNodeConnections,
Reported by PMD.
Line: 140
@CheckForNull private final List<NodeConnection<N>> orderedNodeConnections;
private int predecessorCount;
private int successorCount;
private DirectedGraphConnections(
Map<N, Object> adjacentNodeValues,
@CheckForNull List<NodeConnection<N>> orderedNodeConnections,
int predecessorCount,
Reported by PMD.
guava-tests/test/com/google/common/hash/FarmHashFingerprint64Test.java
74 issues
Line: 190
assertEquals(0x7a1d67c50ec7e167L, h);
}
private static long remix(long h) {
h ^= h >>> 41;
h *= 949921979;
return h;
}
Reported by PMD.
Line: 190
assertEquals(0x7a1d67c50ec7e167L, h);
}
private static long remix(long h) {
h ^= h >>> 41;
h *= 949921979;
return h;
}
Reported by PMD.
Line: 38
private static final HashFunction HASH_FN = Hashing.farmHashFingerprint64();
// If this test fails, all bets are off
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
Reported by PMD.
Line: 38
private static final HashFunction HASH_FN = Hashing.farmHashFingerprint64();
// If this test fails, all bets are off
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
Reported by PMD.
Line: 39
// If this test fails, all bets are off
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
Reported by PMD.
Line: 39
// If this test fails, all bets are off
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
Reported by PMD.
Line: 41
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
public void testStringsConsistency() {
Reported by PMD.
Line: 41
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
public void testStringsConsistency() {
Reported by PMD.
Line: 43
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
public void testStringsConsistency() {
for (String s : Arrays.asList("", "some", "test", "strings", "to", "try")) {
assertEquals(HASH_FN.newHasher().putUnencodedChars(s).hash(), HASH_FN.hashUnencodedChars(s));
Reported by PMD.
Line: 43
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
public void testStringsConsistency() {
for (String s : Arrays.asList("", "some", "test", "strings", "to", "try")) {
assertEquals(HASH_FN.newHasher().putUnencodedChars(s).hash(), HASH_FN.hashUnencodedChars(s));
Reported by PMD.
android/guava-tests/test/com/google/common/hash/FarmHashFingerprint64Test.java
74 issues
Line: 190
assertEquals(0x7a1d67c50ec7e167L, h);
}
private static long remix(long h) {
h ^= h >>> 41;
h *= 949921979;
return h;
}
Reported by PMD.
Line: 190
assertEquals(0x7a1d67c50ec7e167L, h);
}
private static long remix(long h) {
h ^= h >>> 41;
h *= 949921979;
return h;
}
Reported by PMD.
Line: 38
private static final HashFunction HASH_FN = Hashing.farmHashFingerprint64();
// If this test fails, all bets are off
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
Reported by PMD.
Line: 38
private static final HashFunction HASH_FN = Hashing.farmHashFingerprint64();
// If this test fails, all bets are off
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
Reported by PMD.
Line: 39
// If this test fails, all bets are off
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
Reported by PMD.
Line: 39
// If this test fails, all bets are off
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
Reported by PMD.
Line: 41
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
public void testStringsConsistency() {
Reported by PMD.
Line: 41
public void testReallySimpleFingerprints() {
assertEquals(8581389452482819506L, fingerprint("test".getBytes(UTF_8)));
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
public void testStringsConsistency() {
Reported by PMD.
Line: 43
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
public void testStringsConsistency() {
for (String s : Arrays.asList("", "some", "test", "strings", "to", "try")) {
assertEquals(HASH_FN.newHasher().putUnencodedChars(s).hash(), HASH_FN.hashUnencodedChars(s));
Reported by PMD.
Line: 43
// 32 characters long
assertEquals(-4196240717365766262L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8)));
// 256 characters long
assertEquals(3500507768004279527L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8)));
}
public void testStringsConsistency() {
for (String s : Arrays.asList("", "some", "test", "strings", "to", "try")) {
assertEquals(HASH_FN.newHasher().putUnencodedChars(s).hash(), HASH_FN.hashUnencodedChars(s));
Reported by PMD.
android/guava/src/com/google/common/graph/Graphs.java
73 issues
Line: 47
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class Graphs {
private Graphs() {}
// Graph query methods
Reported by PMD.
Line: 47
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class Graphs {
private Graphs() {}
// Graph query methods
Reported by PMD.
Line: 61
* <p>This method will detect any non-empty cycle, including self-loops (a cycle of length 1).
*/
public static <N> boolean hasCycle(Graph<N> graph) {
int numEdges = graph.edges().size();
if (numEdges == 0) {
return false; // An edge-free graph is acyclic by definition.
}
if (!graph.isDirected() && numEdges >= graph.nodes().size()) {
return true; // Optimization for the undirected case: at least one cycle must exist.
Reported by PMD.
Line: 65
if (numEdges == 0) {
return false; // An edge-free graph is acyclic by definition.
}
if (!graph.isDirected() && numEdges >= graph.nodes().size()) {
return true; // Optimization for the undirected case: at least one cycle must exist.
}
Map<Object, NodeVisitState> visitedNodes =
Maps.newHashMapWithExpectedSize(graph.nodes().size());
Reported by PMD.
Line: 70
}
Map<Object, NodeVisitState> visitedNodes =
Maps.newHashMapWithExpectedSize(graph.nodes().size());
for (N node : graph.nodes()) {
if (subgraphHasCycle(graph, visitedNodes, node, null)) {
return true;
}
}
Reported by PMD.
Line: 91
// However, in an undirected graph, any parallel edge induces a cycle in the graph.
if (!network.isDirected()
&& network.allowsParallelEdges()
&& network.edges().size() > network.asGraph().edges().size()) {
return true;
}
return hasCycle(network.asGraph());
}
Reported by PMD.
Line: 91
// However, in an undirected graph, any parallel edge induces a cycle in the graph.
if (!network.isDirected()
&& network.allowsParallelEdges()
&& network.edges().size() > network.asGraph().edges().size()) {
return true;
}
return hasCycle(network.asGraph());
}
Reported by PMD.
Line: 91
// However, in an undirected graph, any parallel edge induces a cycle in the graph.
if (!network.isDirected()
&& network.allowsParallelEdges()
&& network.edges().size() > network.asGraph().edges().size()) {
return true;
}
return hasCycle(network.asGraph());
}
Reported by PMD.
Line: 134
*/
private static boolean canTraverseWithoutReusingEdge(
Graph<?> graph, Object nextNode, @CheckForNull Object previousNode) {
if (graph.isDirected() || !Objects.equal(previousNode, nextNode)) {
return true;
}
// This falls into the undirected A->B->A case. The Graph interface does not support parallel
// edges, so this traversal would require reusing the undirected AB edge.
return false;
Reported by PMD.
Line: 153
*/
// TODO(b/31438252): Consider potential optimizations for this algorithm.
public static <N> Graph<N> transitiveClosure(Graph<N> graph) {
MutableGraph<N> transitiveClosure = GraphBuilder.from(graph).allowsSelfLoops(true).build();
// Every node is, at a minimum, reachable from itself. Since the resulting transitive closure
// will have no isolated nodes, we can skip adding nodes explicitly and let putEdge() do it.
if (graph.isDirected()) {
// Note: works for both directed and undirected graphs, but we only use in the directed case.
Reported by PMD.
guava/src/com/google/common/io/BaseEncoding.java
73 issues
Line: 230
* @throws DecodingException if the input is not a valid encoded string according to this
* encoding.
*/
final byte[] decodeChecked(CharSequence chars)
throws DecodingException {
chars = trimTrailingPadding(chars);
byte[] tmp = new byte[maxDecodedSize(chars.length())];
int len = decodeTo(tmp, chars);
return extract(tmp, len);
Reported by PMD.
Line: 690
}
@Override
public boolean canDecode(CharSequence chars) {
checkNotNull(chars);
chars = trimTrailingPadding(chars);
if (!alphabet.isValidPaddingStartPosition(chars.length())) {
return false;
}
Reported by PMD.
Line: 705
}
@Override
int decodeTo(byte[] target, CharSequence chars) throws DecodingException {
checkNotNull(target);
chars = trimTrailingPadding(chars);
if (!alphabet.isValidPaddingStartPosition(chars.length())) {
throw new DecodingException("Invalid input length " + chars.length());
}
Reported by PMD.
Line: 965
}
@Override
int decodeTo(byte[] target, CharSequence chars) throws DecodingException {
checkNotNull(target);
chars = trimTrailingPadding(chars);
if (!alphabet.isValidPaddingStartPosition(chars.length())) {
throw new DecodingException("Invalid input length " + chars.length());
}
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.io;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkPositionIndexes;
import static com.google.common.base.Preconditions.checkState;
Reported by PMD.
Line: 126
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public abstract class BaseEncoding {
// TODO(lowasser): consider making encodeTo(Appendable, byte[], int, int) public.
BaseEncoding() {}
/**
Reported by PMD.
Line: 126
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public abstract class BaseEncoding {
// TODO(lowasser): consider making encodeTo(Appendable, byte[], int, int) public.
BaseEncoding() {}
/**
Reported by PMD.
Line: 137
* @author Louis Wasserman
* @since 15.0
*/
public static final class DecodingException extends IOException {
DecodingException(String message) {
super(message);
}
DecodingException(Throwable cause) {
Reported by PMD.
Line: 233
final byte[] decodeChecked(CharSequence chars)
throws DecodingException {
chars = trimTrailingPadding(chars);
byte[] tmp = new byte[maxDecodedSize(chars.length())];
int len = decodeTo(tmp, chars);
return extract(tmp, len);
}
/**
Reported by PMD.
Line: 321
*/
public abstract BaseEncoding lowerCase();
private static final BaseEncoding BASE64 =
new Base64Encoding(
"base64()", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", '=');
/**
* The "base64" base encoding specified by <a
Reported by PMD.
android/guava-tests/test/com/google/common/hash/Murmur3Hash32Test.java
73 issues
Line: 27
import junit.framework.TestCase;
/** Tests for {@link Murmur3_32HashFunction}. */
public class Murmur3Hash32Test extends TestCase {
public void testKnownIntegerInputs() {
assertHash(593689054, murmur3_32().hashInt(0));
assertHash(-189366624, murmur3_32().hashInt(-42));
assertHash(-1134849565, murmur3_32().hashInt(42));
assertHash(-1718298732, murmur3_32().hashInt(Integer.MIN_VALUE));
Reported by PMD.
Line: 28
/** Tests for {@link Murmur3_32HashFunction}. */
public class Murmur3Hash32Test extends TestCase {
public void testKnownIntegerInputs() {
assertHash(593689054, murmur3_32().hashInt(0));
assertHash(-189366624, murmur3_32().hashInt(-42));
assertHash(-1134849565, murmur3_32().hashInt(42));
assertHash(-1718298732, murmur3_32().hashInt(Integer.MIN_VALUE));
assertHash(-1653689534, murmur3_32().hashInt(Integer.MAX_VALUE));
Reported by PMD.
Line: 28
/** Tests for {@link Murmur3_32HashFunction}. */
public class Murmur3Hash32Test extends TestCase {
public void testKnownIntegerInputs() {
assertHash(593689054, murmur3_32().hashInt(0));
assertHash(-189366624, murmur3_32().hashInt(-42));
assertHash(-1134849565, murmur3_32().hashInt(42));
assertHash(-1718298732, murmur3_32().hashInt(Integer.MIN_VALUE));
assertHash(-1653689534, murmur3_32().hashInt(Integer.MAX_VALUE));
Reported by PMD.
Line: 29
/** Tests for {@link Murmur3_32HashFunction}. */
public class Murmur3Hash32Test extends TestCase {
public void testKnownIntegerInputs() {
assertHash(593689054, murmur3_32().hashInt(0));
assertHash(-189366624, murmur3_32().hashInt(-42));
assertHash(-1134849565, murmur3_32().hashInt(42));
assertHash(-1718298732, murmur3_32().hashInt(Integer.MIN_VALUE));
assertHash(-1653689534, murmur3_32().hashInt(Integer.MAX_VALUE));
}
Reported by PMD.
Line: 30
public class Murmur3Hash32Test extends TestCase {
public void testKnownIntegerInputs() {
assertHash(593689054, murmur3_32().hashInt(0));
assertHash(-189366624, murmur3_32().hashInt(-42));
assertHash(-1134849565, murmur3_32().hashInt(42));
assertHash(-1718298732, murmur3_32().hashInt(Integer.MIN_VALUE));
assertHash(-1653689534, murmur3_32().hashInt(Integer.MAX_VALUE));
}
Reported by PMD.
Line: 31
public void testKnownIntegerInputs() {
assertHash(593689054, murmur3_32().hashInt(0));
assertHash(-189366624, murmur3_32().hashInt(-42));
assertHash(-1134849565, murmur3_32().hashInt(42));
assertHash(-1718298732, murmur3_32().hashInt(Integer.MIN_VALUE));
assertHash(-1653689534, murmur3_32().hashInt(Integer.MAX_VALUE));
}
public void testKnownLongInputs() {
Reported by PMD.
Line: 32
assertHash(593689054, murmur3_32().hashInt(0));
assertHash(-189366624, murmur3_32().hashInt(-42));
assertHash(-1134849565, murmur3_32().hashInt(42));
assertHash(-1718298732, murmur3_32().hashInt(Integer.MIN_VALUE));
assertHash(-1653689534, murmur3_32().hashInt(Integer.MAX_VALUE));
}
public void testKnownLongInputs() {
assertHash(1669671676, murmur3_32().hashLong(0L));
Reported by PMD.
Line: 33
assertHash(-189366624, murmur3_32().hashInt(-42));
assertHash(-1134849565, murmur3_32().hashInt(42));
assertHash(-1718298732, murmur3_32().hashInt(Integer.MIN_VALUE));
assertHash(-1653689534, murmur3_32().hashInt(Integer.MAX_VALUE));
}
public void testKnownLongInputs() {
assertHash(1669671676, murmur3_32().hashLong(0L));
assertHash(-846261623, murmur3_32().hashLong(-42L));
Reported by PMD.
Line: 36
assertHash(-1653689534, murmur3_32().hashInt(Integer.MAX_VALUE));
}
public void testKnownLongInputs() {
assertHash(1669671676, murmur3_32().hashLong(0L));
assertHash(-846261623, murmur3_32().hashLong(-42L));
assertHash(1871679806, murmur3_32().hashLong(42L));
assertHash(1366273829, murmur3_32().hashLong(Long.MIN_VALUE));
assertHash(-2106506049, murmur3_32().hashLong(Long.MAX_VALUE));
Reported by PMD.
Line: 36
assertHash(-1653689534, murmur3_32().hashInt(Integer.MAX_VALUE));
}
public void testKnownLongInputs() {
assertHash(1669671676, murmur3_32().hashLong(0L));
assertHash(-846261623, murmur3_32().hashLong(-42L));
assertHash(1871679806, murmur3_32().hashLong(42L));
assertHash(1366273829, murmur3_32().hashLong(Long.MIN_VALUE));
assertHash(-2106506049, murmur3_32().hashLong(Long.MAX_VALUE));
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java
73 issues
Line: 47
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapPutTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(absent = SUPPORTS_PUT)
public void testPutUnsupported() {
try {
multimap().put(k3(), v3());
fail("Expected UnsupportedOperationException");
Reported by PMD.
Line: 48
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapPutTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(absent = SUPPORTS_PUT)
public void testPutUnsupported() {
try {
multimap().put(k3(), v3());
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException expected) {
Reported by PMD.
Line: 51
@MapFeature.Require(absent = SUPPORTS_PUT)
public void testPutUnsupported() {
try {
multimap().put(k3(), v3());
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException expected) {
}
}
Reported by PMD.
Line: 57
}
}
@MapFeature.Require(SUPPORTS_PUT)
public void testPutEmpty() {
int size = getNumElements();
assertGet(k3(), ImmutableList.<V>of());
Reported by PMD.
Line: 58
}
@MapFeature.Require(SUPPORTS_PUT)
public void testPutEmpty() {
int size = getNumElements();
assertGet(k3(), ImmutableList.<V>of());
assertTrue(multimap().put(k3(), v3()));
Reported by PMD.
Line: 63
assertGet(k3(), ImmutableList.<V>of());
assertTrue(multimap().put(k3(), v3()));
assertGet(k3(), v3());
assertEquals(size + 1, multimap().size());
}
Reported by PMD.
Line: 66
assertTrue(multimap().put(k3(), v3()));
assertGet(k3(), v3());
assertEquals(size + 1, multimap().size());
}
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPutPresent() {
Reported by PMD.
Line: 69
assertEquals(size + 1, multimap().size());
}
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPutPresent() {
int size = getNumElements();
assertGet(k0(), v0());
Reported by PMD.
Line: 71
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testPutPresent() {
int size = getNumElements();
assertGet(k0(), v0());
assertTrue(multimap().put(k0(), v3()));
Reported by PMD.
Line: 76
assertGet(k0(), v0());
assertTrue(multimap().put(k0(), v3()));
assertGet(k0(), v0(), v3());
assertEquals(size + 1, multimap().size());
}
Reported by PMD.
android/guava/src/com/google/common/io/BaseEncoding.java
73 issues
Line: 230
* @throws DecodingException if the input is not a valid encoded string according to this
* encoding.
*/
final byte[] decodeChecked(CharSequence chars)
throws DecodingException {
chars = trimTrailingPadding(chars);
byte[] tmp = new byte[maxDecodedSize(chars.length())];
int len = decodeTo(tmp, chars);
return extract(tmp, len);
Reported by PMD.
Line: 690
}
@Override
public boolean canDecode(CharSequence chars) {
checkNotNull(chars);
chars = trimTrailingPadding(chars);
if (!alphabet.isValidPaddingStartPosition(chars.length())) {
return false;
}
Reported by PMD.
Line: 705
}
@Override
int decodeTo(byte[] target, CharSequence chars) throws DecodingException {
checkNotNull(target);
chars = trimTrailingPadding(chars);
if (!alphabet.isValidPaddingStartPosition(chars.length())) {
throw new DecodingException("Invalid input length " + chars.length());
}
Reported by PMD.
Line: 965
}
@Override
int decodeTo(byte[] target, CharSequence chars) throws DecodingException {
checkNotNull(target);
chars = trimTrailingPadding(chars);
if (!alphabet.isValidPaddingStartPosition(chars.length())) {
throw new DecodingException("Invalid input length " + chars.length());
}
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.io;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkPositionIndexes;
import static com.google.common.base.Preconditions.checkState;
Reported by PMD.
Line: 126
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public abstract class BaseEncoding {
// TODO(lowasser): consider making encodeTo(Appendable, byte[], int, int) public.
BaseEncoding() {}
/**
Reported by PMD.
Line: 126
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public abstract class BaseEncoding {
// TODO(lowasser): consider making encodeTo(Appendable, byte[], int, int) public.
BaseEncoding() {}
/**
Reported by PMD.
Line: 137
* @author Louis Wasserman
* @since 15.0
*/
public static final class DecodingException extends IOException {
DecodingException(String message) {
super(message);
}
DecodingException(Throwable cause) {
Reported by PMD.
Line: 233
final byte[] decodeChecked(CharSequence chars)
throws DecodingException {
chars = trimTrailingPadding(chars);
byte[] tmp = new byte[maxDecodedSize(chars.length())];
int len = decodeTo(tmp, chars);
return extract(tmp, len);
}
/**
Reported by PMD.
Line: 321
*/
public abstract BaseEncoding lowerCase();
private static final BaseEncoding BASE64 =
new Base64Encoding(
"base64()", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", '=');
/**
* The "base64" base encoding specified by <a
Reported by PMD.