From c5bc741fb8171306e443ab187b32c4ff708c22d0 Mon Sep 17 00:00:00 2001 From: Abel Del Pino Date: Wed, 10 Jul 2024 13:42:05 -0700 Subject: [PATCH 1/6] Fix removeX callsites (4/N) Summary: Because of a Kotlin bug with JDK21 when using SDK 35, removeFirst() and removeLast() cause a runtime `NoSuchMethodError` when called with a MutableList, List or ArrayList. So fixing these callsites before the SDK 35 upgrade Reviewed By: jselbo Differential Revision: D59592734 fbshipit-source-id: 33c5a253917143c59ee9315f2f1a60c4fd88ea60 --- .../flipper/plugins/uidebugger/core/AttributeEditor.kt | 3 ++- .../com/facebook/flipper/plugins/uidebugger/core/BitmapPool.kt | 3 ++- .../flipper/plugins/uidebugger/core/LayoutTraversal.kt | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/AttributeEditor.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/AttributeEditor.kt index 48c9751060e..9cb5074bdbb 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/AttributeEditor.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/AttributeEditor.kt @@ -54,7 +54,8 @@ class AttributeEditor( val stack = mutableListOf(applicationRef) while (stack.isNotEmpty()) { - val curNode = stack.removeLast() + // Workaround for a JDK21/Kotlin bug, see KT-66044 + val curNode = checkNotNull(stack.removeLastOrNull()) val curDescriptor = descriptorRegister.descriptorForClassUnsafe(curNode.javaClass) if (curDescriptor.getId(curNode) == nodeId) { return curNode diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/BitmapPool.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/BitmapPool.kt index 7d2dd19b830..560b6d85520 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/BitmapPool.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/BitmapPool.kt @@ -48,7 +48,8 @@ class BitmapPool(private val config: Bitmap.Config = Bitmap.Config.RGB_565) { return if (bitmaps == null || bitmaps.isEmpty()) { LeasedBitmap(Bitmap.createBitmap(width, height, config)) } else { - LeasedBitmap(bitmaps.removeLast()) + // Workaround for a JDK21/Kotlin bug, see KT-66044 + LeasedBitmap(checkNotNull(bitmaps.removeLastOrNull())) } } diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/LayoutTraversal.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/LayoutTraversal.kt index 1361ca17190..8af64610b4a 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/LayoutTraversal.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/core/LayoutTraversal.kt @@ -41,7 +41,8 @@ class LayoutTraversal( val shallow = mutableSetOf() while (stack.isNotEmpty()) { - val (node, parentId) = stack.removeLast() + // Workaround for a JDK21/Kotlin bug, see KT-66044 + val (node, parentId) = checkNotNull(stack.removeLastOrNull()) try { From 58f08fe3ed63ea41a8d84f9582d2372e60f0bb38 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 11 Jul 2024 03:15:50 -0700 Subject: [PATCH 2/6] Bump Litho dependency to 0.50.1 (#5649) Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/5649 Reviewed By: LukeDefeo Differential Revision: D59595807 Pulled By: passy fbshipit-source-id: de0ae0359ada6363489af9abe8e86cbc29a28f81 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c3a40ea144f..bdca638aa1e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ POM_DEVELOPER_ID=facebook POM_DEVELOPER_NAME=facebook POM_ISSUES_URL=https://github.com/facebook/flipper/issues/ # Shared version numbers -LITHO_VERSION=0.49.0 +LITHO_VERSION=0.50.1 FRESCO_VERSION=3.1.3 ANDROIDX_VERSION=1.3.0 ANDROIDX_ACTIVITY_VERSION=1.8.2 From 3220100d0c63393f63dd847618b7a25e37e5fb24 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 11 Jul 2024 04:11:45 -0700 Subject: [PATCH 3/6] Add missing json serialization dep (#5651) Summary: Something was presumably only added in buck land. Pull Request resolved: https://github.com/facebook/flipper/pull/5651 Test Plan: ``` ./gradlew :sample:assembleDebug BUILD SUCCESSFUL in 1m 53s ``` --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/flipper/pull/5651). * __->__ https://github.com/facebook/flipper/issues/5651 * https://github.com/facebook/flipper/issues/5649 Reviewed By: antonk52 Differential Revision: D59629629 Pulled By: passy fbshipit-source-id: 42979a7c6170b240a3abdd2963c8d5067e25b64e --- android/plugins/litho/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/android/plugins/litho/build.gradle b/android/plugins/litho/build.gradle index 83a3a6a89c2..b583d189f68 100644 --- a/android/plugins/litho/build.gradle +++ b/android/plugins/litho/build.gradle @@ -37,6 +37,7 @@ android { implementation deps.lithoSectionsCore implementation deps.lithoWidget implementation deps.supportAppCompat + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1" compileOnly deps.jsr305 testImplementation deps.junit From 93d55ba3eedb83cc29c9f07c193cd44705ae66b9 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 11 Jul 2024 04:12:12 -0700 Subject: [PATCH 4/6] Update "offline" message Summary: Offline doesn't really mean anything in this context. The problem isn't that you're offline, it's that the server isn't reachable. Changelog: Update offline message Reviewed By: antonk52 Differential Revision: D59629955 fbshipit-source-id: d399470e506d1359ff873f7528b88a1a641aa9e6 --- desktop/static/offline.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/static/offline.html b/desktop/static/offline.html index 3792addc6f9..705a4fc7cd0 100644 --- a/desktop/static/offline.html +++ b/desktop/static/offline.html @@ -6,7 +6,7 @@ - You are offline + Flipper Server not running