Fix issues reported by checkstyle
Test: builds
Change-Id: I41979cc8096a682c6844df0825ee56ab00a828b5
diff --git a/staticlibs/hostdevice/com/android/testutils/ExceptionUtils.java b/staticlibs/hostdevice/com/android/testutils/ExceptionUtils.java
index e7dbed5..d3bda98 100644
--- a/staticlibs/hostdevice/com/android/testutils/ExceptionUtils.java
+++ b/staticlibs/hostdevice/com/android/testutils/ExceptionUtils.java
@@ -18,6 +18,9 @@
import java.util.function.Supplier;
+/**
+ * A class grouping some utilities to deal with exceptions.
+ */
public class ExceptionUtils {
/**
* Like a Consumer, but declared to throw an exception.
@@ -25,6 +28,7 @@
*/
@FunctionalInterface
public interface ThrowingConsumer<T> {
+ /** @see java.util.function.Consumer */
void accept(T t) throws Exception;
}
@@ -34,6 +38,7 @@
*/
@FunctionalInterface
public interface ThrowingSupplier<T> {
+ /** @see java.util.function.Supplier */
T get() throws Exception;
}
@@ -42,10 +47,15 @@
*/
@FunctionalInterface
public interface ThrowingRunnable {
+ /** @see java.lang.Runnable */
void run() throws Exception;
}
-
+ /**
+ * Convert a supplier that throws into one that doesn't.
+ *
+ * The returned supplier returns null in cases where the source throws.
+ */
public static <T> Supplier<T> ignoreExceptions(ThrowingSupplier<T> func) {
return () -> {
try {
@@ -56,6 +66,11 @@
};
}
+ /**
+ * Convert a runnable that throws into one that doesn't.
+ *
+ * All exceptions are ignored by the returned Runnable.
+ */
public static Runnable ignoreExceptions(ThrowingRunnable r) {
return () -> {
try {
diff --git a/staticlibs/hostdevice/com/android/testutils/MiscAsserts.kt b/staticlibs/hostdevice/com/android/testutils/MiscAsserts.kt
index 32c22c2..4e86360 100644
--- a/staticlibs/hostdevice/com/android/testutils/MiscAsserts.kt
+++ b/staticlibs/hostdevice/com/android/testutils/MiscAsserts.kt
@@ -34,7 +34,7 @@
assertEquals(expected, len, "Expected array of length $expected, but was $len for $got")
}
-// Bridge method to help write this in Java. If you're writing Kotlin, consider using native
+// Bridge method to help write this in Java. If you're writing Kotlin, consider using
// kotlin.test.assertFailsWith instead, as that method is reified and inlined.
fun <T : Exception> assertThrows(expected: Class<T>, block: ThrowingRunnable): T {
return assertFailsWith(expected.kotlin) { block.run() }