diff --git a/android/build.gradle b/android/build.gradle index dc30ccae5..2168f4c3e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -151,7 +151,8 @@ subprojects { if (isKotlinLibrary) { def extraCompilerArgs = [ - "-Xjvm-default=all" + // See https://github.com/bazelbuild/bazel/issues/15144 + "-Xjvm-default=enable" ] if (project.name in moduleFriends.keySet()) { def friendName = moduleFriends[project.name] diff --git a/android/libraries/rib-android-core/src/main/kotlin/com/uber/rib/core/ActivityDelegate.kt b/android/libraries/rib-android-core/src/main/kotlin/com/uber/rib/core/ActivityDelegate.kt index 618c92c4f..c91ce8ebd 100644 --- a/android/libraries/rib-android-core/src/main/kotlin/com/uber/rib/core/ActivityDelegate.kt +++ b/android/libraries/rib-android-core/src/main/kotlin/com/uber/rib/core/ActivityDelegate.kt @@ -27,24 +27,31 @@ import androidx.annotation.IntRange */ interface ActivityDelegate { /** @see [Activity.onCreate] */ + @JvmDefault fun onCreate(savedInstanceState: Bundle?) {} /** @see [Activity.onStart] */ + @JvmDefault fun onStart() {} /** @see [Activity.onResume] */ + @JvmDefault fun onResume() {} /** @see [Activity.onPause] */ + @JvmDefault fun onPause() {} /** @see [Activity.onStop] */ + @JvmDefault fun onStop() {} /** @see [Activity.onDestroy] */ + @JvmDefault fun onDestroy() {} /** @see [Activity.onActivityResult] */ + @JvmDefault fun onActivityResult( activity: Activity, requestCode: Int, @@ -53,6 +60,7 @@ interface ActivityDelegate { ) {} /** @see [Activity.onRequestPermissionsResult] */ + @JvmDefault fun onRequestPermissionsResult( activity: Activity, @IntRange(from = 0, to = 255) requestCode: Int, diff --git a/android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/RxActivityEvents.kt b/android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/RxActivityEvents.kt index 1e83cdfd3..7d3e77529 100644 --- a/android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/RxActivityEvents.kt +++ b/android/libraries/rib-android/src/main/kotlin/com/uber/rib/core/RxActivityEvents.kt @@ -32,6 +32,7 @@ interface RxActivityEvents { * @param clazz The [ActivityLifecycleEvent] subclass you want. * @return an observable of this activity's lifecycle events. */ + @JvmDefault fun lifecycle(clazz: Class): Observable { return lifecycle() .filter { activityEvent -> clazz.isAssignableFrom(activityEvent.javaClass) } @@ -43,6 +44,7 @@ interface RxActivityEvents { * @param clazz The [ActivityCallbackEvent] subclass you want. * @return an observable of this activity's callbacks events. */ + @JvmDefault fun callbacks(clazz: Class): Observable { return callbacks() .filter { activityEvent -> clazz.isAssignableFrom(activityEvent.javaClass) } diff --git a/android/libraries/rib-base/src/main/kotlin/com/uber/rib/core/Worker.kt b/android/libraries/rib-base/src/main/kotlin/com/uber/rib/core/Worker.kt index 8e1664ed2..241b4a75e 100644 --- a/android/libraries/rib-base/src/main/kotlin/com/uber/rib/core/Worker.kt +++ b/android/libraries/rib-base/src/main/kotlin/com/uber/rib/core/Worker.kt @@ -27,8 +27,10 @@ interface Worker { * * @param lifecycle The lifecycle of the worker to use for subscriptions. */ + @JvmDefault fun onStart(lifecycle: WorkerScopeProvider) {} /** Called when the worker is stopped. */ + @JvmDefault fun onStop() {} }