The following issues were found
android/guava/src/com/google/common/collect/ForwardingNavigableSet.java
19 issues
Line: 56
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class ForwardingNavigableSet<E extends @Nullable Object>
extends ForwardingSortedSet<E> implements NavigableSet<E> {
/** Constructor for use by subclasses. */
protected ForwardingNavigableSet() {}
@Override
Reported by PMD.
Line: 67
@Override
@CheckForNull
public E lower(@ParametricNullness E e) {
return delegate().lower(e);
}
/**
* A sensible definition of {@link #lower} in terms of the {@code descendingIterator} method of
* {@link #headSet(Object, boolean)}. If you override {@link #headSet(Object, boolean)}, you may
Reported by PMD.
Line: 77
*/
@CheckForNull
protected E standardLower(@ParametricNullness E e) {
return Iterators.getNext(headSet(e, false).descendingIterator(), null);
}
@Override
@CheckForNull
public E floor(@ParametricNullness E e) {
Reported by PMD.
Line: 83
@Override
@CheckForNull
public E floor(@ParametricNullness E e) {
return delegate().floor(e);
}
/**
* A sensible definition of {@link #floor} in terms of the {@code descendingIterator} method of
* {@link #headSet(Object, boolean)}. If you override {@link #headSet(Object, boolean)}, you may
Reported by PMD.
Line: 93
*/
@CheckForNull
protected E standardFloor(@ParametricNullness E e) {
return Iterators.getNext(headSet(e, true).descendingIterator(), null);
}
@Override
@CheckForNull
public E ceiling(@ParametricNullness E e) {
Reported by PMD.
Line: 99
@Override
@CheckForNull
public E ceiling(@ParametricNullness E e) {
return delegate().ceiling(e);
}
/**
* A sensible definition of {@link #ceiling} in terms of the {@code iterator} method of {@link
* #tailSet(Object, boolean)}. If you override {@link #tailSet(Object, boolean)}, you may wish to
Reported by PMD.
Line: 109
*/
@CheckForNull
protected E standardCeiling(@ParametricNullness E e) {
return Iterators.getNext(tailSet(e, true).iterator(), null);
}
@Override
@CheckForNull
public E higher(@ParametricNullness E e) {
Reported by PMD.
Line: 115
@Override
@CheckForNull
public E higher(@ParametricNullness E e) {
return delegate().higher(e);
}
/**
* A sensible definition of {@link #higher} in terms of the {@code iterator} method of {@link
* #tailSet(Object, boolean)}. If you override {@link #tailSet(Object, boolean)}, you may wish to
Reported by PMD.
Line: 125
*/
@CheckForNull
protected E standardHigher(@ParametricNullness E e) {
return Iterators.getNext(tailSet(e, false).iterator(), null);
}
@Override
@CheckForNull
public E pollFirst() {
Reported by PMD.
Line: 131
@Override
@CheckForNull
public E pollFirst() {
return delegate().pollFirst();
}
/**
* A sensible definition of {@link #pollFirst} in terms of the {@code iterator} method. If you
* override {@link #iterator} you may wish to override {@link #pollFirst} to forward to this
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/AbstractService.java
19 issues
Line: 53
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class AbstractService implements Service {
private static final ListenerCallQueue.Event<Listener> STARTING_EVENT =
new ListenerCallQueue.Event<Listener>() {
@Override
public void call(Listener listener) {
listener.starting();
Reported by PMD.
Line: 53
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public abstract class AbstractService implements Service {
private static final ListenerCallQueue.Event<Listener> STARTING_EVENT =
new ListenerCallQueue.Event<Listener>() {
@Override
public void call(Listener listener) {
listener.starting();
Reported by PMD.
Line: 120
};
}
private final Monitor monitor = new Monitor();
private final Guard isStartable = new IsStartableGuard();
@WeakOuter
private final class IsStartableGuard extends Guard {
Reported by PMD.
Line: 122
private final Monitor monitor = new Monitor();
private final Guard isStartable = new IsStartableGuard();
@WeakOuter
private final class IsStartableGuard extends Guard {
IsStartableGuard() {
super(AbstractService.this.monitor);
Reported by PMD.
Line: 136
}
}
private final Guard isStoppable = new IsStoppableGuard();
@WeakOuter
private final class IsStoppableGuard extends Guard {
IsStoppableGuard() {
super(AbstractService.this.monitor);
Reported by PMD.
Line: 146
@Override
public boolean isSatisfied() {
return state().compareTo(RUNNING) <= 0;
}
}
private final Guard hasReachedRunning = new HasReachedRunningGuard();
Reported by PMD.
Line: 150
}
}
private final Guard hasReachedRunning = new HasReachedRunningGuard();
@WeakOuter
private final class HasReachedRunningGuard extends Guard {
HasReachedRunningGuard() {
super(AbstractService.this.monitor);
Reported by PMD.
Line: 160
@Override
public boolean isSatisfied() {
return state().compareTo(RUNNING) >= 0;
}
}
private final Guard isStopped = new IsStoppedGuard();
Reported by PMD.
Line: 164
}
}
private final Guard isStopped = new IsStoppedGuard();
@WeakOuter
private final class IsStoppedGuard extends Guard {
IsStoppedGuard() {
super(AbstractService.this.monitor);
Reported by PMD.
Line: 174
@Override
public boolean isSatisfied() {
return state().compareTo(TERMINATED) >= 0;
}
}
/** The listeners to notify during a state transition. */
private final ListenerCallQueue<Listener> listeners = new ListenerCallQueue<>();
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/AbstractListeningExecutorServiceTest.java
19 issues
Line: 34
*/
public class AbstractListeningExecutorServiceTest extends TestCase {
public void testSubmit() throws Exception {
/*
* Mostly just tests that TrustedListenableFutureTask are created and run; tests for
* TrustedListenableFutureTask should ensure that listeners are called correctly.
*/
Reported by PMD.
Line: 34
*/
public class AbstractListeningExecutorServiceTest extends TestCase {
public void testSubmit() throws Exception {
/*
* Mostly just tests that TrustedListenableFutureTask are created and run; tests for
* TrustedListenableFutureTask should ensure that listeners are called correctly.
*/
Reported by PMD.
Line: 44
TestRunnable runnable = new TestRunnable();
ListenableFuture<?> runnableFuture = e.submit(runnable);
assertThat(runnableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(runnableFuture.isDone());
assertTrue(runnable.run);
ListenableFuture<String> callableFuture = e.submit(new TestCallable());
assertThat(callableFuture).isInstanceOf(TrustedListenableFutureTask.class);
Reported by PMD.
Line: 45
TestRunnable runnable = new TestRunnable();
ListenableFuture<?> runnableFuture = e.submit(runnable);
assertThat(runnableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(runnableFuture.isDone());
assertTrue(runnable.run);
ListenableFuture<String> callableFuture = e.submit(new TestCallable());
assertThat(callableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(callableFuture.isDone());
Reported by PMD.
Line: 45
TestRunnable runnable = new TestRunnable();
ListenableFuture<?> runnableFuture = e.submit(runnable);
assertThat(runnableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(runnableFuture.isDone());
assertTrue(runnable.run);
ListenableFuture<String> callableFuture = e.submit(new TestCallable());
assertThat(callableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(callableFuture.isDone());
Reported by PMD.
Line: 46
ListenableFuture<?> runnableFuture = e.submit(runnable);
assertThat(runnableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(runnableFuture.isDone());
assertTrue(runnable.run);
ListenableFuture<String> callableFuture = e.submit(new TestCallable());
assertThat(callableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(callableFuture.isDone());
assertEquals("foo", callableFuture.get());
Reported by PMD.
Line: 49
assertTrue(runnable.run);
ListenableFuture<String> callableFuture = e.submit(new TestCallable());
assertThat(callableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(callableFuture.isDone());
assertEquals("foo", callableFuture.get());
TestRunnable runnable2 = new TestRunnable();
ListenableFuture<Integer> runnableFuture2 = e.submit(runnable2, 3);
Reported by PMD.
Line: 50
ListenableFuture<String> callableFuture = e.submit(new TestCallable());
assertThat(callableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(callableFuture.isDone());
assertEquals("foo", callableFuture.get());
TestRunnable runnable2 = new TestRunnable();
ListenableFuture<Integer> runnableFuture2 = e.submit(runnable2, 3);
assertThat(runnableFuture2).isInstanceOf(TrustedListenableFutureTask.class);
Reported by PMD.
Line: 51
ListenableFuture<String> callableFuture = e.submit(new TestCallable());
assertThat(callableFuture).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(callableFuture.isDone());
assertEquals("foo", callableFuture.get());
TestRunnable runnable2 = new TestRunnable();
ListenableFuture<Integer> runnableFuture2 = e.submit(runnable2, 3);
assertThat(runnableFuture2).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(runnableFuture2.isDone());
Reported by PMD.
Line: 55
TestRunnable runnable2 = new TestRunnable();
ListenableFuture<Integer> runnableFuture2 = e.submit(runnable2, 3);
assertThat(runnableFuture2).isInstanceOf(TrustedListenableFutureTask.class);
assertTrue(runnableFuture2.isDone());
assertTrue(runnable2.run);
assertEquals((Integer) 3, runnableFuture2.get());
}
Reported by PMD.
android/guava/src/com/google/common/primitives/Floats.java
19 issues
Line: 172
continue outer;
}
}
return i;
}
return -1;
}
/**
Reported by PMD.
Line: 51
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Floats extends FloatsMethodsForWeb {
private Floats() {}
/**
* The number of bytes required to represent a primitive {@code float} value.
*
Reported by PMD.
Line: 51
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Floats extends FloatsMethodsForWeb {
private Floats() {}
/**
* The number of bytes required to represent a primitive {@code float} value.
*
Reported by PMD.
Line: 460
public static void reverse(float[] array, int fromIndex, int toIndex) {
checkNotNull(array);
checkPositionIndexes(fromIndex, toIndex, array.length);
for (int i = fromIndex, j = toIndex - 1; i < j; i++, j--) {
float tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
}
Reported by PMD.
Line: 520
@GwtCompatible
private static class FloatArrayAsList extends AbstractList<Float>
implements RandomAccess, Serializable {
final float[] array;
final int start;
final int end;
FloatArrayAsList(float[] array) {
this(array, 0, array.length);
Reported by PMD.
Line: 521
private static class FloatArrayAsList extends AbstractList<Float>
implements RandomAccess, Serializable {
final float[] array;
final int start;
final int end;
FloatArrayAsList(float[] array) {
this(array, 0, array.length);
}
Reported by PMD.
Line: 522
implements RandomAccess, Serializable {
final float[] array;
final int start;
final int end;
FloatArrayAsList(float[] array) {
this(array, 0, array.length);
}
Reported by PMD.
Line: 528
this(array, 0, array.length);
}
FloatArrayAsList(float[] array, int start, int end) {
this.array = array;
this.start = start;
this.end = end;
}
Reported by PMD.
Line: 607
if (object instanceof FloatArrayAsList) {
FloatArrayAsList that = (FloatArrayAsList) object;
int size = size();
if (that.size() != size) {
return false;
}
for (int i = 0; i < size; i++) {
if (array[start + i] != that.array[that.start + i]) {
return false;
Reported by PMD.
Line: 667
@GwtIncompatible // regular expressions
@CheckForNull
public static Float tryParse(String string) {
if (Doubles.FLOATING_POINT_PATTERN.matcher(string).matches()) {
// TODO(lowasser): could be potentially optimized, but only with
// extensive testing
try {
return Float.parseFloat(string);
} catch (NumberFormatException e) {
Reported by PMD.
android/guava/src/com/google/common/io/FileBackedOutputStream.java
19 issues
Line: 160
private synchronized InputStream openInputStream() throws IOException {
if (file != null) {
return new FileInputStream(file);
} else {
// requireNonNull is safe because we always have either `file` or `memory`.
requireNonNull(memory);
return new ByteArrayInputStream(memory.getBuffer(), 0, memory.getCount());
}
Reported by PMD.
Line: 235
temp.deleteOnExit();
}
try {
FileOutputStream transfer = new FileOutputStream(temp);
transfer.write(memory.getBuffer(), 0, memory.getCount());
transfer.flush();
// We've successfully transferred the data; switch to writing to file
out = transfer;
} catch (IOException e) {
Reported by PMD.
Line: 57
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class FileBackedOutputStream extends OutputStream {
private final int fileThreshold;
private final boolean resetOnFinalize;
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
Reported by PMD.
Line: 58
@ElementTypesAreNonnullByDefault
public final class FileBackedOutputStream extends OutputStream {
private final int fileThreshold;
private final boolean resetOnFinalize;
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
Reported by PMD.
Line: 59
public final class FileBackedOutputStream extends OutputStream {
private final int fileThreshold;
private final boolean resetOnFinalize;
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
Reported by PMD.
Line: 60
private final int fileThreshold;
private final boolean resetOnFinalize;
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
@GuardedBy("this")
Reported by PMD.
Line: 62
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
@GuardedBy("this")
@CheckForNull
private MemoryOutput memory;
Reported by PMD.
Line: 63
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
@GuardedBy("this")
@CheckForNull
private MemoryOutput memory;
Reported by PMD.
Line: 67
@GuardedBy("this")
@CheckForNull
private MemoryOutput memory;
@GuardedBy("this")
@CheckForNull
private File file;
Reported by PMD.
Line: 71
@GuardedBy("this")
@CheckForNull
private File file;
/** ByteArrayOutputStream that exposes its internals. */
private static class MemoryOutput extends ByteArrayOutputStream {
byte[] getBuffer() {
return buf;
Reported by PMD.
android/guava/src/com/google/common/base/FinalizableReferenceQueue.java
19 issues
Line: 167
} catch (IllegalAccessException impossible) {
throw new AssertionError(impossible); // startFinalizer() is public
} catch (Throwable t) {
logger.log(
Level.INFO,
"Failed to start reference finalizer thread."
+ " Reference cleanup will only occur when new references are created.",
t);
}
Reported by PMD.
Line: 148
}
/** The actual reference queue that our background thread will poll. */
final ReferenceQueue<Object> queue;
final PhantomReference<Object> frqRef;
/** Whether or not the background thread started successfully. */
final boolean threadStarted;
Reported by PMD.
Line: 150
/** The actual reference queue that our background thread will poll. */
final ReferenceQueue<Object> queue;
final PhantomReference<Object> frqRef;
/** Whether or not the background thread started successfully. */
final boolean threadStarted;
/** Constructs a new queue. */
Reported by PMD.
Line: 153
final PhantomReference<Object> frqRef;
/** Whether or not the background thread started successfully. */
final boolean threadStarted;
/** Constructs a new queue. */
public FinalizableReferenceQueue() {
// We could start the finalizer lazily, but I'd rather it blow up early.
queue = new ReferenceQueue<>();
Reported by PMD.
Line: 166
threadStarted = true;
} catch (IllegalAccessException impossible) {
throw new AssertionError(impossible); // startFinalizer() is public
} catch (Throwable t) {
logger.log(
Level.INFO,
"Failed to start reference finalizer thread."
+ " Reference cleanup will only occur when new references are created.",
t);
Reported by PMD.
Line: 194
}
Reference<?> reference;
while ((reference = queue.poll()) != null) {
/*
* This is for the benefit of phantom references. Weak and soft references will have already
* been cleared by this point.
*/
reference.clear();
Reported by PMD.
Line: 202
reference.clear();
try {
((FinalizableReference) reference).finalizeReferent();
} catch (Throwable t) {
logger.log(Level.SEVERE, "Error cleaning up after reference.", t);
}
}
}
Reported by PMD.
Line: 297
* System class loader will (and must) be the parent.
*/
ClassLoader finalizerLoader = newLoader(getBaseUrl());
return finalizerLoader.loadClass(FINALIZER_CLASS_NAME);
} catch (Exception e) {
logger.log(Level.WARNING, LOADING_ERROR, e);
return null;
}
}
Reported by PMD.
Line: 298
*/
ClassLoader finalizerLoader = newLoader(getBaseUrl());
return finalizerLoader.loadClass(FINALIZER_CLASS_NAME);
} catch (Exception e) {
logger.log(Level.WARNING, LOADING_ERROR, e);
return null;
}
}
Reported by PMD.
Line: 308
URL getBaseUrl() throws IOException {
// Find URL pointing to Finalizer.class file.
String finalizerPath = FINALIZER_CLASS_NAME.replace('.', '/') + ".class";
URL finalizerUrl = getClass().getClassLoader().getResource(finalizerPath);
if (finalizerUrl == null) {
throw new FileNotFoundException(finalizerPath);
}
// Find URL pointing to base of class path.
Reported by PMD.
android/guava-tests/test/com/google/common/math/QuantilesAlgorithm.java
19 issues
Line: 34
* @author Pete Gillin
* @since 20.0
*/
enum QuantilesAlgorithm {
/**
* Sorts the dataset, and picks values from it. When computing multiple quantiles, we sort once
* and pick multiple values.
*/
Reported by PMD.
Line: 34
* @author Pete Gillin
* @since 20.0
*/
enum QuantilesAlgorithm {
/**
* Sorts the dataset, and picks values from it. When computing multiple quantiles, we sort once
* and pick multiple values.
*/
Reported by PMD.
Line: 109
@Override
double singleQuantile(int index, int scale, double[] dataset) {
return Quantiles.scale(scale).index(index).computeInPlace(dataset);
}
@Override
Map<Integer, Double> multipleQuantiles(
Collection<Integer> indexes, int scale, double[] dataset) {
Reported by PMD.
Line: 109
@Override
double singleQuantile(int index, int scale, double[] dataset) {
return Quantiles.scale(scale).index(index).computeInPlace(dataset);
}
@Override
Map<Integer, Double> multipleQuantiles(
Collection<Integer> indexes, int scale, double[] dataset) {
Reported by PMD.
Line: 115
@Override
Map<Integer, Double> multipleQuantiles(
Collection<Integer> indexes, int scale, double[] dataset) {
return Quantiles.scale(scale).indexes(indexes).computeInPlace(dataset);
}
},
;
/**
Reported by PMD.
Line: 115
@Override
Map<Integer, Double> multipleQuantiles(
Collection<Integer> indexes, int scale, double[] dataset) {
return Quantiles.scale(scale).indexes(indexes).computeInPlace(dataset);
}
},
;
/**
Reported by PMD.
Line: 145
return array[min];
}
static double select(int k, double[] array) {
// This is basically a copy of com.google.math.Rank#select, with a small change in the method
// signature: we make k 0-based rather than 1-based; and we drop from and to, and always work on
// the whole array.
int from = 0;
int to = array.length - 1;
Reported by PMD.
Line: 145
return array[min];
}
static double select(int k, double[] array) {
// This is basically a copy of com.google.math.Rank#select, with a small change in the method
// signature: we make k 0-based rather than 1-based; and we drop from and to, and always work on
// the whole array.
int from = 0;
int to = array.length - 1;
Reported by PMD.
Line: 145
return array[min];
}
static double select(int k, double[] array) {
// This is basically a copy of com.google.math.Rank#select, with a small change in the method
// signature: we make k 0-based rather than 1-based; and we drop from and to, and always work on
// the whole array.
int from = 0;
int to = array.length - 1;
Reported by PMD.
Line: 145
return array[min];
}
static double select(int k, double[] array) {
// This is basically a copy of com.google.math.Rank#select, with a small change in the method
// signature: we make k 0-based rather than 1-based; and we drop from and to, and always work on
// the whole array.
int from = 0;
int to = array.length - 1;
Reported by PMD.
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.
guava/src/com/google/common/primitives/Floats.java
19 issues
Line: 172
continue outer;
}
}
return i;
}
return -1;
}
/**
Reported by PMD.
Line: 51
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Floats extends FloatsMethodsForWeb {
private Floats() {}
/**
* The number of bytes required to represent a primitive {@code float} value.
*
Reported by PMD.
Line: 51
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Floats extends FloatsMethodsForWeb {
private Floats() {}
/**
* The number of bytes required to represent a primitive {@code float} value.
*
Reported by PMD.
Line: 460
public static void reverse(float[] array, int fromIndex, int toIndex) {
checkNotNull(array);
checkPositionIndexes(fromIndex, toIndex, array.length);
for (int i = fromIndex, j = toIndex - 1; i < j; i++, j--) {
float tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
}
Reported by PMD.
Line: 520
@GwtCompatible
private static class FloatArrayAsList extends AbstractList<Float>
implements RandomAccess, Serializable {
final float[] array;
final int start;
final int end;
FloatArrayAsList(float[] array) {
this(array, 0, array.length);
Reported by PMD.
Line: 521
private static class FloatArrayAsList extends AbstractList<Float>
implements RandomAccess, Serializable {
final float[] array;
final int start;
final int end;
FloatArrayAsList(float[] array) {
this(array, 0, array.length);
}
Reported by PMD.
Line: 522
implements RandomAccess, Serializable {
final float[] array;
final int start;
final int end;
FloatArrayAsList(float[] array) {
this(array, 0, array.length);
}
Reported by PMD.
Line: 528
this(array, 0, array.length);
}
FloatArrayAsList(float[] array, int start, int end) {
this.array = array;
this.start = start;
this.end = end;
}
Reported by PMD.
Line: 607
if (object instanceof FloatArrayAsList) {
FloatArrayAsList that = (FloatArrayAsList) object;
int size = size();
if (that.size() != size) {
return false;
}
for (int i = 0; i < size; i++) {
if (array[start + i] != that.array[that.start + i]) {
return false;
Reported by PMD.
Line: 667
@GwtIncompatible // regular expressions
@CheckForNull
public static Float tryParse(String string) {
if (Doubles.FLOATING_POINT_PATTERN.matcher(string).matches()) {
// TODO(lowasser): could be potentially optimized, but only with
// extensive testing
try {
return Float.parseFloat(string);
} catch (NumberFormatException e) {
Reported by PMD.
guava/src/com/google/common/io/FileBackedOutputStream.java
19 issues
Line: 160
private synchronized InputStream openInputStream() throws IOException {
if (file != null) {
return new FileInputStream(file);
} else {
// requireNonNull is safe because we always have either `file` or `memory`.
requireNonNull(memory);
return new ByteArrayInputStream(memory.getBuffer(), 0, memory.getCount());
}
Reported by PMD.
Line: 235
temp.deleteOnExit();
}
try {
FileOutputStream transfer = new FileOutputStream(temp);
transfer.write(memory.getBuffer(), 0, memory.getCount());
transfer.flush();
// We've successfully transferred the data; switch to writing to file
out = transfer;
} catch (IOException e) {
Reported by PMD.
Line: 57
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class FileBackedOutputStream extends OutputStream {
private final int fileThreshold;
private final boolean resetOnFinalize;
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
Reported by PMD.
Line: 58
@ElementTypesAreNonnullByDefault
public final class FileBackedOutputStream extends OutputStream {
private final int fileThreshold;
private final boolean resetOnFinalize;
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
Reported by PMD.
Line: 59
public final class FileBackedOutputStream extends OutputStream {
private final int fileThreshold;
private final boolean resetOnFinalize;
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
Reported by PMD.
Line: 60
private final int fileThreshold;
private final boolean resetOnFinalize;
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
@GuardedBy("this")
Reported by PMD.
Line: 62
private final ByteSource source;
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
@GuardedBy("this")
@CheckForNull
private MemoryOutput memory;
Reported by PMD.
Line: 63
@CheckForNull private final File parentDirectory;
@GuardedBy("this")
private OutputStream out;
@GuardedBy("this")
@CheckForNull
private MemoryOutput memory;
Reported by PMD.
Line: 67
@GuardedBy("this")
@CheckForNull
private MemoryOutput memory;
@GuardedBy("this")
@CheckForNull
private File file;
Reported by PMD.
Line: 71
@GuardedBy("this")
@CheckForNull
private File file;
/** ByteArrayOutputStream that exposes its internals. */
private static class MemoryOutput extends ByteArrayOutputStream {
byte[] getBuffer() {
return buf;
Reported by PMD.