Closed Bug 1829228 Opened 2 years ago Closed 2 years ago

Update Kotlin to 1.8.20

Categories

(Fenix :: General, task)

All
Android
task

Tracking

(firefox114 fixed)

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: RyanVM, Assigned: RyanVM)

References

Details

Attachments

(1 file)

Also picking up the latest Compose Compiler update for the needed version compatibility bump.

Changelogs:

I've got this mostly working, though there's one test failure that I'm having difficulty reasoning about:
https://firefox-ci-tc.services.mozilla.com/tasks/Gr9tp6_5Sq-Pu2k7WYkUBQ/runs/5/logs/public/logs/live.log

TEST: getParcelableArrayCompat with unexpected type returns empty array and does not throw exception
FAILURE

java.lang.ArrayStoreException: mozilla.components.support.utils.BundleTest$Companion$Unexpected
	at mozilla.components.support.utils.BundleTest.getParcelableArrayCompat with unexpected type returns empty array and does not throw exception(BundleTest.kt:166)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:580)
	at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:287)
	at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:99)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
TEST: safeCastToArrayOfT with unexpected elements returns empty array and does not throw exception
FAILURE

java.lang.ArrayStoreException: mozilla.components.support.utils.BundleTest$Companion$Unexpected
	at mozilla.components.support.utils.BundleTest.safeCastToArrayOfT with unexpected elements returns empty array and does not throw exception(BundleTest.kt:124)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:580)
	at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:287)
	at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:99)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

Looking through the Kotlin 1.8.20 changelog, I see a few commits related to arrays in there. Looking at the code for BundleTest.kt, https://youtrack.jetbrains.com/issue/KT-55005 looks maybe-relevant?

Hi Jon and Mihai - any ideas what might be up with those BundleTest failures? AFAICT, that's all we're blocked on for taking this update. The WIP patch is here:
https://github.com/mozilla-mobile/firefox-android/compare/main...b1829228_kotlin

Flags: needinfo?(mcarare)
Flags: needinfo?(jonalmeida942)

An additional check can be added in the safeCastToArrayOfT method in order to avoid throwing the exception. Not sure what changed (did not find anything related in the release notes).

 /**
 * Cast a [Parcelable] [Array] to a <T implements [Parcelable]> [Array]
 */
inline fun <reified T : Parcelable> Array<Parcelable>.safeCastToArrayOfT(): Array<T> {
    return Array(this.size) { index ->
        if (this[index] is T) {
            this[index] as? T
        } else {
            null
        }
    }.filterNotNull().toTypedArray()
}
Flags: needinfo?(mcarare)
Flags: needinfo?(jonalmeida942)
Status: NEW → RESOLVED
Closed: 2 years ago
Flags: qe-verify+
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
Flags: qe-verify+
See Also: → 1829938
Blocks: 1831239
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: