Correct a comment
Test: TH
Change-Id: I08ac8f0f40b9e3732564da73057cd3d22c06c79b
diff --git a/staticlibs/testutils/Android.bp b/staticlibs/testutils/Android.bp
index 29df759..1be64c1 100644
--- a/staticlibs/testutils/Android.bp
+++ b/staticlibs/testutils/Android.bp
@@ -55,8 +55,8 @@
"//frameworks/libs/net/common/tests:__subpackages__",
"//frameworks/libs/net/client-libs/tests:__subpackages__",
],
- // sc-mainline-prod uses an old version of Kotlin that used
- // to reserve the right to make breaking changes to the
+ // There are downstream branches using an old version of Kotlin
+ // that used to reserve the right to make breaking changes to the
// Result type and disallowed returning an instance of it.
// Later versions allowed this and there was never a change,
// so no matter the version returning Result is always fine,
diff --git a/staticlibs/testutils/hostdevice/com/android/testutils/Cleanup.kt b/staticlibs/testutils/hostdevice/com/android/testutils/Cleanup.kt
index eec8128..1b67f68 100644
--- a/staticlibs/testutils/hostdevice/com/android/testutils/Cleanup.kt
+++ b/staticlibs/testutils/hostdevice/com/android/testutils/Cleanup.kt
@@ -22,6 +22,14 @@
import com.android.testutils.ExceptionUtils.ThrowingSupplier
import javax.annotation.CheckReturnValue
+@CheckReturnValue
+fun <T> tryTest(block: () -> T) = TryExpr(
+ try {
+ Result.success(block())
+ } catch (e: Throwable) {
+ Result.failure(e)
+ })
+
/**
* Utility to do cleanup in tests without replacing exceptions with those from a finally block.
*
@@ -67,8 +75,8 @@
* });
*/
-// sc-mainline-prod has an older kotlin that doesn't know about value classes. TODO : Change this
-// to "value class" when aosp no longer merges into sc-mainline-prod.
+// Some downstream branches have an older kotlin that doesn't know about value classes.
+// TODO : Change this to "value class" when aosp no longer merges into such branches.
@Suppress("INLINE_CLASS_DEPRECATED")
inline class TryExpr<T>(val result: Result<T>) {
inline infix fun <reified E : Throwable> catch(block: (E) -> T): TryExpr<T> {
@@ -97,14 +105,6 @@
}
}
-@CheckReturnValue
-fun <T> tryTest(block: () -> T) = TryExpr(
- try {
- Result.success(block())
- } catch (e: Throwable) {
- Result.failure(e)
- })
-
// Java support
fun <T> testAndCleanup(tryBlock: ThrowingSupplier<T>, cleanupBlock: ThrowingRunnable): T {
return tryTest {