Remove backward compatibility flag
Kotlin updates to 1.4 and fixes an issue where @JvmOverload methods
were not final.
See https://kotlinlang.org/docs/reference/compatibility-guide-14.html#generated-overloads-for-jvmoverloads-on-open-methods-should-be-final
Remove the backward compatibility flag by special-casing the method
that needs to be overridden at this time, which gets rid of the
local concern.
Bug: 166499531
Test: Builds, atest ConnectivityServiceTest
Change-Id: Ia13c67876f99dafd77d890e82d62453713b7b5fe
diff --git a/staticlibs/Android.bp b/staticlibs/Android.bp
index 1143e05..f4799f0 100644
--- a/staticlibs/Android.bp
+++ b/staticlibs/Android.bp
@@ -102,9 +102,6 @@
"net-tests-utils-host-device-common",
"net-utils-device-common",
],
- kotlincflags: [
- "-XXLanguage:-GenerateJvmOverloadsAsFinal"
- ]
}
filegroup {
diff --git a/staticlibs/devicetests/com/android/testutils/TestableNetworkCallback.kt b/staticlibs/devicetests/com/android/testutils/TestableNetworkCallback.kt
index 959a837..3c038fa 100644
--- a/staticlibs/devicetests/com/android/testutils/TestableNetworkCallback.kt
+++ b/staticlibs/devicetests/com/android/testutils/TestableNetworkCallback.kt
@@ -170,8 +170,11 @@
}
// Make open for use in ConnectivityServiceTest which is the only one knowing its handlers.
- @JvmOverloads
- open fun assertNoCallback(timeoutMs: Long = defaultTimeoutMs) {
+ // TODO : remove the necessity to overload this, remove the open qualifier, and give a
+ // default argument to assertNoCallback instead, possibly with @JvmOverloads if necessary.
+ open fun assertNoCallback() = assertNoCallback(defaultTimeoutMs)
+
+ fun assertNoCallback(timeoutMs: Long) {
val cb = history.poll(timeoutMs)
if (null != cb) fail("Expected no callback but got $cb")
}