The following issues were found
android/guava/src/com/google/common/collect/NaturalOrdering.java
2 issues
Line: 33
final class NaturalOrdering extends Ordering<Comparable<?>> implements Serializable {
static final NaturalOrdering INSTANCE = new NaturalOrdering();
@CheckForNull private transient Ordering<@Nullable Comparable<?>> nullsFirst;
@CheckForNull private transient Ordering<@Nullable Comparable<?>> nullsLast;
@Override
public int compare(Comparable<?> left, Comparable<?> right) {
checkNotNull(left); // for GWT
Reported by PMD.
Line: 34
static final NaturalOrdering INSTANCE = new NaturalOrdering();
@CheckForNull private transient Ordering<@Nullable Comparable<?>> nullsFirst;
@CheckForNull private transient Ordering<@Nullable Comparable<?>> nullsLast;
@Override
public int compare(Comparable<?> left, Comparable<?> right) {
checkNotNull(left); // for GWT
checkNotNull(right);
Reported by PMD.
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/MapMaker.java
2 issues
Line: 30
* @author Charles Fry
*/
public final class MapMaker {
private int initialCapacity = 16;
public MapMaker() {}
public MapMaker initialCapacity(int initialCapacity) {
if (initialCapacity < 0) {
Reported by PMD.
Line: 30
* @author Charles Fry
*/
public final class MapMaker {
private int initialCapacity = 16;
public MapMaker() {}
public MapMaker initialCapacity(int initialCapacity) {
if (initialCapacity < 0) {
Reported by PMD.
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Platform.java
2 issues
Line: 35
*
* @author Hayward Chan
*/
final class Platform {
static <K, V> Map<K, V> newHashMapWithExpectedSize(int expectedSize) {
return Maps.newHashMapWithExpectedSize(expectedSize);
}
static <K, V> Map<K, V> newLinkedHashMapWithExpectedSize(int expectedSize) {
Reported by PMD.
Line: 87
}
/** Equivalent to Arrays.copyOfRange(source, from, to, arrayOfType.getClass()). */
static <T> T[] copy(Object[] source, int from, int to, T[] arrayOfType) {
T[] result = newArray(arrayOfType, to - from);
System.arraycopy(source, from, result, 0, to - from);
return result;
}
Reported by PMD.
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RangeGwtSerializationDependencies.java
2 issues
Line: 23
import java.io.Serializable;
@GwtCompatible(emulated = true)
abstract class RangeGwtSerializationDependencies<C extends Comparable> implements Serializable {
C dummy;
}
Reported by PMD.
Line: 23
import java.io.Serializable;
@GwtCompatible(emulated = true)
abstract class RangeGwtSerializationDependencies<C extends Comparable> implements Serializable {
C dummy;
}
Reported by PMD.
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableBiMap.java
2 issues
Line: 34
// This reference is used both by the GWT compiler to infer the elements
// of the lists that needs to be serialized.
private ImmutableBiMap<V, K> inverse;
RegularImmutableBiMap() {
super(new RegularImmutableMap<K, V>(new HashMap<K, V>()));
this.inverse = (ImmutableBiMap<V, K>) this;
}
Reported by PMD.
Line: 34
// This reference is used both by the GWT compiler to infer the elements
// of the lists that needs to be serialized.
private ImmutableBiMap<V, K> inverse;
RegularImmutableBiMap() {
super(new RegularImmutableMap<K, V>(new HashMap<K, V>()));
this.inverse = (ImmutableBiMap<V, K>) this;
}
Reported by PMD.
android/guava/src/com/google/common/base/Enums.java
2 issues
Line: 82
Class<T> enumClass) {
Map<String, WeakReference<? extends Enum<?>>> result = new HashMap<>();
for (T enumInstance : EnumSet.allOf(enumClass)) {
result.put(enumInstance.name(), new WeakReference<Enum<?>>(enumInstance));
}
enumConstantCache.put(enumClass, result);
return result;
}
Reported by PMD.
Line: 115
private static final class StringConverter<T extends Enum<T>> extends Converter<String, T>
implements Serializable {
private final Class<T> enumClass;
StringConverter(Class<T> enumClass) {
this.enumClass = checkNotNull(enumClass);
}
Reported by PMD.
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableSet.java
2 issues
Line: 26
*
* @author Hayward Chan
*/
final class SingletonImmutableSet<E> extends ImmutableSet<E> {
// This reference is used both by the custom field serializer, and by the
// GWT compiler to infer the elements of the lists that needs to be
// serialized.
//
Reported by PMD.
Line: 33
// serialized.
//
// Although this reference is non-final, it doesn't change after set creation.
E element;
SingletonImmutableSet(E element) {
this.element = checkNotNull(element);
}
Reported by PMD.
guava-gwt/test-super/com/google/common/collect/testing/super/com/google/common/collect/testing/Platform.java
2 issues
Line: 61
builder.append(", ");
builder.append(args[i++]);
}
builder.append("]");
}
return builder.toString();
}
Reported by PMD.
Line: 32
// Class.cast is not supported in GWT.
static void checkCast(Class<?> clazz, Object obj) {}
static <T> T[] clone(T[] array) {
return (T[]) Arrays.copyOfRange(array, 0, array.length);
}
// TODO: Consolidate different copies in one single place.
static String format(String template, Object... args) {
Reported by PMD.
android/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java
2 issues
Line: 41
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ImmutableMultisetGwtSerializationDependencies<E> extends ImmutableCollection<E> {}
Reported by PMD.
Line: 41
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class ImmutableMultisetGwtSerializationDependencies<E> extends ImmutableCollection<E> {}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/CollectionTestSuiteBuilder.java
2 issues
Line: 53
parentBuilder) {
List<TestSuite> derivedSuites = new ArrayList<>(super.createDerivedSuites(parentBuilder));
if (parentBuilder.getFeatures().contains(SERIALIZABLE)) {
derivedSuites.add(
CollectionTestSuiteBuilder.using(
new ReserializedCollectionGenerator<E>(parentBuilder.getSubjectGenerator()))
.named(getName() + " reserialized")
.withFeatures(computeReserializedCollectionFeatures(parentBuilder.getFeatures()))
Reported by PMD.
Line: 68
}
static class ReserializedCollectionGenerator<E> implements TestCollectionGenerator<E> {
final OneSizeTestContainerGenerator<Collection<E>, E> gen;
private ReserializedCollectionGenerator(OneSizeTestContainerGenerator<Collection<E>, E> gen) {
this.gen = gen;
}
Reported by PMD.