The following issues were found
android/guava-tests/test/com/google/common/graph/MapCacheTest.java
19 issues
Line: 84
@Test
public void testRemoveEqualKeyWithDifferentReference() {
String fooReference1 = new String("foo");
String fooReference2 = new String("foo");
assertThat(fooReference1).isNotSameInstanceAs(fooReference2);
assertThat(mapCache.put(fooReference1, "bar")).isNull();
assertThat(mapCache.get(fooReference1)).isEqualTo("bar"); // ensure first reference is cached
Reported by PMD.
Line: 85
@Test
public void testRemoveEqualKeyWithDifferentReference() {
String fooReference1 = new String("foo");
String fooReference2 = new String("foo");
assertThat(fooReference1).isNotSameInstanceAs(fooReference2);
assertThat(mapCache.put(fooReference1, "bar")).isNull();
assertThat(mapCache.get(fooReference1)).isEqualTo("bar"); // ensure first reference is cached
assertThat(mapCache.remove(fooReference2)).isEqualTo("bar");
Reported by PMD.
Line: 38
// TODO(cpovirk): Figure out Android JUnit 4 support. Does it work with Gingerbread? @RunWith?
@RunWith(Parameterized.class)
public final class MapCacheTest {
private final MapIteratorCache<String, String> mapCache;
public MapCacheTest(MapIteratorCache<String, String> mapCache) {
this.mapCache = mapCache;
}
Reported by PMD.
Line: 46
@Parameters
public static Collection<Object[]> parameters() {
Comparator<String> nullsLast = Ordering.natural().nullsLast();
return Arrays.asList(
new Object[][] {
{new MapIteratorCache<String, String>(new HashMap<String, String>())},
{new MapIteratorCache<String, String>(new TreeMap<String, String>(nullsLast))},
Reported by PMD.
Line: 63
}
@Test
public void testKeySetIterator() {
mapCache.put("A", "A_value");
mapCache.put("B", "B_value");
mapCache.put("C", "C_value");
assertThat(mapCache.unmodifiableKeySet()).hasSize(3);
Reported by PMD.
Line: 68
mapCache.put("B", "B_value");
mapCache.put("C", "C_value");
assertThat(mapCache.unmodifiableKeySet()).hasSize(3);
for (String key : mapCache.unmodifiableKeySet()) {
assertThat(mapCache.get(key)).isEqualTo(key + "_value");
}
}
Reported by PMD.
Line: 70
assertThat(mapCache.unmodifiableKeySet()).hasSize(3);
for (String key : mapCache.unmodifiableKeySet()) {
assertThat(mapCache.get(key)).isEqualTo(key + "_value");
}
}
@Test
public void testPutNewValue() {
Reported by PMD.
Line: 75
}
@Test
public void testPutNewValue() {
assertThat(mapCache.put("key", "value")).isNull();
assertThat(mapCache.get("key")).isEqualTo("value"); // ensure key/value is cached
assertThat(mapCache.put("key", "new value")).isEqualTo("value");
assertThat(mapCache.get("key")).isEqualTo("new value");
}
Reported by PMD.
Line: 76
@Test
public void testPutNewValue() {
assertThat(mapCache.put("key", "value")).isNull();
assertThat(mapCache.get("key")).isEqualTo("value"); // ensure key/value is cached
assertThat(mapCache.put("key", "new value")).isEqualTo("value");
assertThat(mapCache.get("key")).isEqualTo("new value");
}
Reported by PMD.
Line: 76
@Test
public void testPutNewValue() {
assertThat(mapCache.put("key", "value")).isNull();
assertThat(mapCache.get("key")).isEqualTo("value"); // ensure key/value is cached
assertThat(mapCache.put("key", "new value")).isEqualTo("value");
assertThat(mapCache.get("key")).isEqualTo("new value");
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/SortedListsTest.java
19 issues
Line: 31
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class SortedListsTest extends TestCase {
private static final ImmutableList<Integer> LIST_WITH_DUPS =
ImmutableList.of(1, 1, 2, 4, 4, 4, 8);
private static final ImmutableList<Integer> LIST_WITHOUT_DUPS = ImmutableList.of(1, 2, 4, 8);
Reported by PMD.
Line: 37
private static final ImmutableList<Integer> LIST_WITHOUT_DUPS = ImmutableList.of(1, 2, 4, 8);
void assertModelAgrees(
List<Integer> list,
Integer key,
int answer,
KeyPresentBehavior presentBehavior,
KeyAbsentBehavior absentBehavior) {
Reported by PMD.
Line: 37
private static final ImmutableList<Integer> LIST_WITHOUT_DUPS = ImmutableList.of(1, 2, 4, 8);
void assertModelAgrees(
List<Integer> list,
Integer key,
int answer,
KeyPresentBehavior presentBehavior,
KeyAbsentBehavior absentBehavior) {
Reported by PMD.
Line: 46
switch (presentBehavior) {
case FIRST_PRESENT:
if (list.contains(key)) {
assertEquals(list.indexOf(key), answer);
return;
}
break;
case LAST_PRESENT:
if (list.contains(key)) {
Reported by PMD.
Line: 52
break;
case LAST_PRESENT:
if (list.contains(key)) {
assertEquals(list.lastIndexOf(key), answer);
return;
}
break;
case ANY_PRESENT:
if (list.contains(key)) {
Reported by PMD.
Line: 58
break;
case ANY_PRESENT:
if (list.contains(key)) {
assertEquals(key, list.get(answer));
return;
}
break;
case FIRST_AFTER:
if (list.contains(key)) {
Reported by PMD.
Line: 64
break;
case FIRST_AFTER:
if (list.contains(key)) {
assertEquals(list.lastIndexOf(key) + 1, answer);
return;
}
break;
case LAST_BEFORE:
if (list.contains(key)) {
Reported by PMD.
Line: 70
break;
case LAST_BEFORE:
if (list.contains(key)) {
assertEquals(list.indexOf(key) - 1, answer);
return;
}
break;
default:
throw new AssertionError();
Reported by PMD.
Line: 84
}
switch (absentBehavior) {
case NEXT_LOWER:
assertEquals(nextHigherIndex - 1, answer);
return;
case NEXT_HIGHER:
assertEquals(nextHigherIndex, answer);
return;
case INVERTED_INSERTION_INDEX:
Reported by PMD.
Line: 87
assertEquals(nextHigherIndex - 1, answer);
return;
case NEXT_HIGHER:
assertEquals(nextHigherIndex, answer);
return;
case INVERTED_INSERTION_INDEX:
assertEquals(-1 - nextHigherIndex, answer);
return;
default:
Reported by PMD.
android/guava-tests/test/com/google/common/collect/CompactLinkedHashSetTest.java
19 issues
Line: 41
*/
@GwtIncompatible // java.util.Arrays#copyOf(Object[], int), java.lang.reflect.Array
public class CompactLinkedHashSetTest extends TestCase {
public static Test suite() {
List<Feature<?>> allFeatures =
Arrays.<Feature<?>>asList(
CollectionSize.ANY,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
Reported by PMD.
Line: 70
return suite;
}
public void testAllocArraysDefault() {
CompactHashSet<Integer> set = CompactHashSet.create();
assertThat(set.needsAllocArrays()).isTrue();
assertThat(set.elements).isNull();
set.add(1);
Reported by PMD.
Line: 70
return suite;
}
public void testAllocArraysDefault() {
CompactHashSet<Integer> set = CompactHashSet.create();
assertThat(set.needsAllocArrays()).isTrue();
assertThat(set.elements).isNull();
set.add(1);
Reported by PMD.
Line: 72
public void testAllocArraysDefault() {
CompactHashSet<Integer> set = CompactHashSet.create();
assertThat(set.needsAllocArrays()).isTrue();
assertThat(set.elements).isNull();
set.add(1);
assertThat(set.needsAllocArrays()).isFalse();
assertThat(set.elements).hasLength(CompactHashing.DEFAULT_SIZE);
Reported by PMD.
Line: 72
public void testAllocArraysDefault() {
CompactHashSet<Integer> set = CompactHashSet.create();
assertThat(set.needsAllocArrays()).isTrue();
assertThat(set.elements).isNull();
set.add(1);
assertThat(set.needsAllocArrays()).isFalse();
assertThat(set.elements).hasLength(CompactHashing.DEFAULT_SIZE);
Reported by PMD.
Line: 73
public void testAllocArraysDefault() {
CompactHashSet<Integer> set = CompactHashSet.create();
assertThat(set.needsAllocArrays()).isTrue();
assertThat(set.elements).isNull();
set.add(1);
assertThat(set.needsAllocArrays()).isFalse();
assertThat(set.elements).hasLength(CompactHashing.DEFAULT_SIZE);
}
Reported by PMD.
Line: 75
assertThat(set.needsAllocArrays()).isTrue();
assertThat(set.elements).isNull();
set.add(1);
assertThat(set.needsAllocArrays()).isFalse();
assertThat(set.elements).hasLength(CompactHashing.DEFAULT_SIZE);
}
public void testAllocArraysExpectedSize() {
Reported by PMD.
Line: 76
assertThat(set.elements).isNull();
set.add(1);
assertThat(set.needsAllocArrays()).isFalse();
assertThat(set.elements).hasLength(CompactHashing.DEFAULT_SIZE);
}
public void testAllocArraysExpectedSize() {
for (int i = 0; i <= CompactHashing.DEFAULT_SIZE; i++) {
Reported by PMD.
Line: 76
assertThat(set.elements).isNull();
set.add(1);
assertThat(set.needsAllocArrays()).isFalse();
assertThat(set.elements).hasLength(CompactHashing.DEFAULT_SIZE);
}
public void testAllocArraysExpectedSize() {
for (int i = 0; i <= CompactHashing.DEFAULT_SIZE; i++) {
Reported by PMD.
Line: 77
set.add(1);
assertThat(set.needsAllocArrays()).isFalse();
assertThat(set.elements).hasLength(CompactHashing.DEFAULT_SIZE);
}
public void testAllocArraysExpectedSize() {
for (int i = 0; i <= CompactHashing.DEFAULT_SIZE; i++) {
CompactHashSet<Integer> set = CompactHashSet.createWithExpectedSize(i);
Reported by PMD.
android/guava-tests/benchmark/com/google/common/base/StringsRepeatBenchmark.java
19 issues
Line: 47
for (int i = 0; i < reps; i++) {
String x = oldRepeat(originalString, count);
if (x.length() != (originalString.length() * count)) {
throw new RuntimeException("Wrong length: " + x);
}
}
}
private static String oldRepeat(String string, int count) {
Reported by PMD.
Line: 69
for (int i = 0; i < reps; i++) {
String x = mikeRepeat(originalString, count);
if (x.length() != (originalString.length() * count)) {
throw new RuntimeException("Wrong length: " + x);
}
}
}
private static String mikeRepeat(String string, int count) {
Reported by PMD.
Line: 102
for (int i = 0; i < reps; i++) {
String x = martinRepeat(originalString, count);
if (x.length() != (originalString.length() * count)) {
throw new RuntimeException("Wrong length: " + x);
}
}
}
private static String martinRepeat(String string, int count) {
Reported by PMD.
Line: 74
}
}
private static String mikeRepeat(String string, int count) {
final int len = string.length();
char[] strCopy = new char[len * Integer.highestOneBit(count)];
string.getChars(0, len, strCopy, 0);
char[] array = new char[len * count];
Reported by PMD.
Line: 30
*/
public class StringsRepeatBenchmark {
@Param({"1", "5", "25", "125"})
int count;
@Param({"1", "10"})
int length;
private String originalString;
Reported by PMD.
Line: 33
int count;
@Param({"1", "10"})
int length;
private String originalString;
@BeforeExperiment
void setUp() {
Reported by PMD.
Line: 35
@Param({"1", "10"})
int length;
private String originalString;
@BeforeExperiment
void setUp() {
originalString = Strings.repeat("x", length);
}
Reported by PMD.
Line: 37
private String originalString;
@BeforeExperiment
void setUp() {
originalString = Strings.repeat("x", length);
}
@Benchmark
Reported by PMD.
Line: 46
void oldRepeat(int reps) {
for (int i = 0; i < reps; i++) {
String x = oldRepeat(originalString, count);
if (x.length() != (originalString.length() * count)) {
throw new RuntimeException("Wrong length: " + x);
}
}
}
Reported by PMD.
Line: 46
void oldRepeat(int reps) {
for (int i = 0; i < reps; i++) {
String x = oldRepeat(originalString, count);
if (x.length() != (originalString.length() * count)) {
throw new RuntimeException("Wrong length: " + x);
}
}
}
Reported by PMD.
android/guava-tests/benchmark/com/google/common/collect/MapBenchmark.java
19 issues
Line: 40
*/
public class MapBenchmark {
@Param({"Hash", "LinkedHM", "MapMaker1", "Immutable"})
private Impl impl;
public enum Impl {
Hash {
@Override
Map<Element, Element> create(Collection<Element> keys) {
Reported by PMD.
Line: 160
}
@Param({"5", "50", "500", "5000", "50000"})
private int size;
// TODO: look at exact (==) hits vs. equals() hits?
@Param("0.9")
private double hitRate;
Reported by PMD.
Line: 164
// TODO: look at exact (==) hits vs. equals() hits?
@Param("0.9")
private double hitRate;
@Param("true")
private boolean isUserTypeFast;
// "" means no fixed seed
Reported by PMD.
Line: 167
private double hitRate;
@Param("true")
private boolean isUserTypeFast;
// "" means no fixed seed
@Param("")
private SpecialRandom random;
Reported by PMD.
Line: 171
// "" means no fixed seed
@Param("")
private SpecialRandom random;
@Param("false")
private boolean sortedData;
// the following must be set during setUp
Reported by PMD.
Line: 174
private SpecialRandom random;
@Param("false")
private boolean sortedData;
// the following must be set during setUp
private Element[] queries;
private Map<Element, Element> mapToTest;
Reported by PMD.
Line: 177
private boolean sortedData;
// the following must be set during setUp
private Element[] queries;
private Map<Element, Element> mapToTest;
private Collection<Element> values;
@BeforeExperiment
Reported by PMD.
Line: 178
// the following must be set during setUp
private Element[] queries;
private Map<Element, Element> mapToTest;
private Collection<Element> values;
@BeforeExperiment
void setUp() {
Reported by PMD.
Line: 180
private Element[] queries;
private Map<Element, Element> mapToTest;
private Collection<Element> values;
@BeforeExperiment
void setUp() {
CollectionBenchmarkSampleData sampleData =
new CollectionBenchmarkSampleData(isUserTypeFast, random, hitRate, size);
Reported by PMD.
Line: 182
private Collection<Element> values;
@BeforeExperiment
void setUp() {
CollectionBenchmarkSampleData sampleData =
new CollectionBenchmarkSampleData(isUserTypeFast, random, hitRate, size);
if (sortedData) {
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java
19 issues
Line: 51
@Beta
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class SimpleTimeLimiter implements TimeLimiter {
private final ExecutorService executor;
private SimpleTimeLimiter(ExecutorService executor) {
this.executor = checkNotNull(executor);
Reported by PMD.
Line: 51
@Beta
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class SimpleTimeLimiter implements TimeLimiter {
private final ExecutorService executor;
private SimpleTimeLimiter(ExecutorService executor) {
this.executor = checkNotNull(executor);
Reported by PMD.
Line: 53
@ElementTypesAreNonnullByDefault
public final class SimpleTimeLimiter implements TimeLimiter {
private final ExecutorService executor;
private SimpleTimeLimiter(ExecutorService executor) {
this.executor = checkNotNull(executor);
}
Reported by PMD.
Line: 118
private static <T> T newProxy(Class<T> interfaceType, InvocationHandler handler) {
Object object =
Proxy.newProxyInstance(
interfaceType.getClassLoader(), new Class<?>[] {interfaceType}, handler);
return interfaceType.cast(object);
}
private <T extends @Nullable Object> T callWithTimeout(
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible)
Reported by PMD.
Line: 124
private <T extends @Nullable Object> T callWithTimeout(
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit, boolean amInterruptible)
throws Exception {
checkNotNull(callable);
checkNotNull(timeoutUnit);
checkPositiveTimeout(timeoutDuration);
Future<T> future = executor.submit(callable);
Reported by PMD.
Line: 168
throw e;
} catch (ExecutionException e) {
wrapAndThrowExecutionExceptionOrError(e.getCause());
throw new AssertionError();
}
}
@CanIgnoreReturnValue
@Override
Reported by PMD.
Line: 190
throw e;
} catch (ExecutionException e) {
wrapAndThrowExecutionExceptionOrError(e.getCause());
throw new AssertionError();
}
}
@Override
public void runWithTimeout(Runnable runnable, long timeoutDuration, TimeUnit timeoutUnit)
Reported by PMD.
Line: 210
throw e;
} catch (ExecutionException e) {
wrapAndThrowRuntimeExecutionExceptionOrError(e.getCause());
throw new AssertionError();
}
}
@Override
public void runUninterruptiblyWithTimeout(
Reported by PMD.
Line: 230
throw e;
} catch (ExecutionException e) {
wrapAndThrowRuntimeExecutionExceptionOrError(e.getCause());
throw new AssertionError();
}
}
private static Exception throwCause(Exception e, boolean combineStackTraces) throws Exception {
Throwable cause = e.getCause();
Reported by PMD.
Line: 234
}
}
private static Exception throwCause(Exception e, boolean combineStackTraces) throws Exception {
Throwable cause = e.getCause();
if (cause == null) {
throw e;
}
if (combineStackTraces) {
Reported by PMD.
android/guava/src/com/google/common/reflect/Invokable.java
19 issues
Line: 417
try {
return constructor.newInstance(args);
} catch (InstantiationException e) {
throw new RuntimeException(constructor + " failed.", e);
}
}
/**
* If the class is parameterized, such as {@link java.util.ArrayList ArrayList}, this returns
Reported by PMD.
Line: 68
@Beta
@ElementTypesAreNonnullByDefault
public abstract class Invokable<T, R> implements AnnotatedElement, Member {
private final AccessibleObject accessibleObject;
private final Member member;
<M extends AccessibleObject & Member> Invokable(M member) {
checkNotNull(member);
this.accessibleObject = member;
Reported by PMD.
Line: 69
@ElementTypesAreNonnullByDefault
public abstract class Invokable<T, R> implements AnnotatedElement, Member {
private final AccessibleObject accessibleObject;
private final Member member;
<M extends AccessibleObject & Member> Invokable(M member) {
checkNotNull(member);
this.accessibleObject = member;
this.member = member;
Reported by PMD.
Line: 127
try {
accessibleObject.setAccessible(true);
return true;
} catch (RuntimeException e) {
return false;
}
}
/** See {@link java.lang.reflect.AccessibleObject#isAccessible()}. */
Reported by PMD.
Line: 217
public boolean equals(@CheckForNull Object obj) {
if (obj instanceof Invokable) {
Invokable<?, ?> that = (Invokable<?, ?>) obj;
return getOwnerType().equals(that.getOwnerType()) && member.equals(that.member);
}
return false;
}
@Override
Reported by PMD.
Line: 217
public boolean equals(@CheckForNull Object obj) {
if (obj instanceof Invokable) {
Invokable<?, ?> that = (Invokable<?, ?>) obj;
return getOwnerType().equals(that.getOwnerType()) && member.equals(that.member);
}
return false;
}
@Override
Reported by PMD.
Line: 255
* @throws InvocationTargetException if the underlying method or constructor throws an exception.
*/
// All subclasses are owned by us and we'll make sure to get the R type right, including nullness.
@SuppressWarnings({"unchecked", "nullness"})
@CanIgnoreReturnValue
@CheckForNull
public final R invoke(@CheckForNull T receiver, @Nullable Object... args)
throws InvocationTargetException, IllegalAccessException {
return (R) invokeInternal(receiver, checkNotNull(args));
Reported by PMD.
Line: 280
Annotation[][] annotations = getParameterAnnotations();
ImmutableList.Builder<Parameter> builder = ImmutableList.builder();
for (int i = 0; i < parameterTypes.length; i++) {
builder.add(new Parameter(this, i, TypeToken.of(parameterTypes[i]), annotations[i]));
}
return builder.build();
}
/** Returns all declared exception types of this {@code Invokable}. */
Reported by PMD.
Line: 330
/** Returns the type of {@code T}. */
// Overridden in TypeToken#method() and TypeToken#constructor()
@SuppressWarnings("unchecked") // The declaring class is T.
public TypeToken<T> getOwnerType() {
return (TypeToken<T>) TypeToken.of(getDeclaringClass());
}
@CheckForNull
abstract Object invokeInternal(@CheckForNull Object receiver, @Nullable Object[] args)
Reported by PMD.
Line: 349
static class MethodInvokable<T> extends Invokable<T, Object> {
final Method method;
MethodInvokable(Method method) {
super(method);
this.method = method;
}
Reported by PMD.
android/guava/src/com/google/common/io/ReaderInputStream.java
19 issues
Line: 48
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
final class ReaderInputStream extends InputStream {
private final Reader reader;
private final CharsetEncoder encoder;
private final byte[] singleByte = new byte[1];
/**
Reported by PMD.
Line: 48
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
final class ReaderInputStream extends InputStream {
private final Reader reader;
private final CharsetEncoder encoder;
private final byte[] singleByte = new byte[1];
/**
Reported by PMD.
Line: 49
@GwtIncompatible
@ElementTypesAreNonnullByDefault
final class ReaderInputStream extends InputStream {
private final Reader reader;
private final CharsetEncoder encoder;
private final byte[] singleByte = new byte[1];
/**
* charBuffer holds characters that have been read from the Reader but not encoded yet. The buffer
Reported by PMD.
Line: 50
@ElementTypesAreNonnullByDefault
final class ReaderInputStream extends InputStream {
private final Reader reader;
private final CharsetEncoder encoder;
private final byte[] singleByte = new byte[1];
/**
* charBuffer holds characters that have been read from the Reader but not encoded yet. The buffer
* is perpetually "flipped" (unencoded characters between position and limit).
Reported by PMD.
Line: 51
final class ReaderInputStream extends InputStream {
private final Reader reader;
private final CharsetEncoder encoder;
private final byte[] singleByte = new byte[1];
/**
* charBuffer holds characters that have been read from the Reader but not encoded yet. The buffer
* is perpetually "flipped" (unencoded characters between position and limit).
*/
Reported by PMD.
Line: 57
* charBuffer holds characters that have been read from the Reader but not encoded yet. The buffer
* is perpetually "flipped" (unencoded characters between position and limit).
*/
private CharBuffer charBuffer;
/**
* byteBuffer holds encoded characters that have not yet been sent to the caller of the input
* stream. When encoding it is "unflipped" (encoded bytes between 0 and position) and when
* draining it is flipped (undrained bytes between position and limit).
Reported by PMD.
Line: 64
* stream. When encoding it is "unflipped" (encoded bytes between 0 and position) and when
* draining it is flipped (undrained bytes between position and limit).
*/
private ByteBuffer byteBuffer;
/** Whether we've finished reading the reader. */
private boolean endOfInput;
/** Whether we're copying encoded bytes to the caller's buffer. */
private boolean draining;
Reported by PMD.
Line: 67
private ByteBuffer byteBuffer;
/** Whether we've finished reading the reader. */
private boolean endOfInput;
/** Whether we're copying encoded bytes to the caller's buffer. */
private boolean draining;
/** Whether we've successfully flushed the encoder. */
private boolean doneFlushing;
Reported by PMD.
Line: 69
/** Whether we've finished reading the reader. */
private boolean endOfInput;
/** Whether we're copying encoded bytes to the caller's buffer. */
private boolean draining;
/** Whether we've successfully flushed the encoder. */
private boolean doneFlushing;
/**
* Creates a new input stream that will encode the characters from {@code reader} into bytes using
Reported by PMD.
Line: 71
/** Whether we're copying encoded bytes to the caller's buffer. */
private boolean draining;
/** Whether we've successfully flushed the encoder. */
private boolean doneFlushing;
/**
* Creates a new input stream that will encode the characters from {@code reader} into bytes using
* the given character set. Malformed input and unmappable characters will be replaced.
*
Reported by PMD.
android/guava/src/com/google/common/collect/DescendingMultiset.java
19 issues
Line: 37
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
abstract class DescendingMultiset<E extends @Nullable Object> extends ForwardingMultiset<E>
implements SortedMultiset<E> {
abstract SortedMultiset<E> forwardMultiset();
@CheckForNull private transient Comparator<? super E> comparator;
@Override
Reported by PMD.
Line: 40
implements SortedMultiset<E> {
abstract SortedMultiset<E> forwardMultiset();
@CheckForNull private transient Comparator<? super E> comparator;
@Override
public Comparator<? super E> comparator() {
Comparator<? super E> result = comparator;
if (result == null) {
Reported by PMD.
Line: 46
public Comparator<? super E> comparator() {
Comparator<? super E> result = comparator;
if (result == null) {
return comparator = Ordering.from(forwardMultiset().comparator()).<E>reverse();
}
return result;
}
@CheckForNull private transient NavigableSet<E> elementSet;
Reported by PMD.
Line: 46
public Comparator<? super E> comparator() {
Comparator<? super E> result = comparator;
if (result == null) {
return comparator = Ordering.from(forwardMultiset().comparator()).<E>reverse();
}
return result;
}
@CheckForNull private transient NavigableSet<E> elementSet;
Reported by PMD.
Line: 51
return result;
}
@CheckForNull private transient NavigableSet<E> elementSet;
@Override
public NavigableSet<E> elementSet() {
NavigableSet<E> result = elementSet;
if (result == null) {
Reported by PMD.
Line: 65
@Override
@CheckForNull
public Entry<E> pollFirstEntry() {
return forwardMultiset().pollLastEntry();
}
@Override
@CheckForNull
public Entry<E> pollLastEntry() {
Reported by PMD.
Line: 71
@Override
@CheckForNull
public Entry<E> pollLastEntry() {
return forwardMultiset().pollFirstEntry();
}
@Override
public SortedMultiset<E> headMultiset(@ParametricNullness E toElement, BoundType boundType) {
return forwardMultiset().tailMultiset(toElement, boundType).descendingMultiset();
Reported by PMD.
Line: 76
@Override
public SortedMultiset<E> headMultiset(@ParametricNullness E toElement, BoundType boundType) {
return forwardMultiset().tailMultiset(toElement, boundType).descendingMultiset();
}
@Override
public SortedMultiset<E> subMultiset(
@ParametricNullness E fromElement,
Reported by PMD.
Line: 76
@Override
public SortedMultiset<E> headMultiset(@ParametricNullness E toElement, BoundType boundType) {
return forwardMultiset().tailMultiset(toElement, boundType).descendingMultiset();
}
@Override
public SortedMultiset<E> subMultiset(
@ParametricNullness E fromElement,
Reported by PMD.
Line: 85
BoundType fromBoundType,
@ParametricNullness E toElement,
BoundType toBoundType) {
return forwardMultiset()
.subMultiset(toElement, toBoundType, fromElement, fromBoundType)
.descendingMultiset();
}
@Override
Reported by PMD.
guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/DescendingMultiset.java
19 issues
Line: 32
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
abstract class DescendingMultiset<E> extends ForwardingMultiset<E> implements SortedMultiset<E> {
abstract SortedMultiset<E> forwardMultiset();
private transient Comparator<? super E> comparator;
@Override
Reported by PMD.
Line: 35
abstract class DescendingMultiset<E> extends ForwardingMultiset<E> implements SortedMultiset<E> {
abstract SortedMultiset<E> forwardMultiset();
private transient Comparator<? super E> comparator;
@Override
public Comparator<? super E> comparator() {
Comparator<? super E> result = comparator;
if (result == null) {
Reported by PMD.
Line: 41
public Comparator<? super E> comparator() {
Comparator<? super E> result = comparator;
if (result == null) {
return comparator = Ordering.from(forwardMultiset().comparator()).<E>reverse();
}
return result;
}
private transient SortedSet<E> elementSet;
Reported by PMD.
Line: 41
public Comparator<? super E> comparator() {
Comparator<? super E> result = comparator;
if (result == null) {
return comparator = Ordering.from(forwardMultiset().comparator()).<E>reverse();
}
return result;
}
private transient SortedSet<E> elementSet;
Reported by PMD.
Line: 46
return result;
}
private transient SortedSet<E> elementSet;
@Override
public SortedSet<E> elementSet() {
SortedSet<E> result = elementSet;
if (result == null) {
Reported by PMD.
Line: 59
@Override
public Entry<E> pollFirstEntry() {
return forwardMultiset().pollLastEntry();
}
@Override
public Entry<E> pollLastEntry() {
return forwardMultiset().pollFirstEntry();
Reported by PMD.
Line: 64
@Override
public Entry<E> pollLastEntry() {
return forwardMultiset().pollFirstEntry();
}
@Override
public SortedMultiset<E> headMultiset(E toElement, BoundType boundType) {
return forwardMultiset().tailMultiset(toElement, boundType).descendingMultiset();
Reported by PMD.
Line: 69
@Override
public SortedMultiset<E> headMultiset(E toElement, BoundType boundType) {
return forwardMultiset().tailMultiset(toElement, boundType).descendingMultiset();
}
@Override
public SortedMultiset<E> subMultiset(
E fromElement, BoundType fromBoundType, E toElement, BoundType toBoundType) {
Reported by PMD.
Line: 69
@Override
public SortedMultiset<E> headMultiset(E toElement, BoundType boundType) {
return forwardMultiset().tailMultiset(toElement, boundType).descendingMultiset();
}
@Override
public SortedMultiset<E> subMultiset(
E fromElement, BoundType fromBoundType, E toElement, BoundType toBoundType) {
Reported by PMD.
Line: 75
@Override
public SortedMultiset<E> subMultiset(
E fromElement, BoundType fromBoundType, E toElement, BoundType toBoundType) {
return forwardMultiset()
.subMultiset(toElement, toBoundType, fromElement, fromBoundType)
.descendingMultiset();
}
@Override
Reported by PMD.