Skip to content

Commit 30862fc

Browse files
tsushanthmarkushi
andauthored
fix(compose): add isImportantForBounds() to SentryTagModifierNode for compose-ui 1.11+ (#5672)
* fix(compose): add isImportantForBounds() to SentryTagModifierNode for compose-ui 1.11+ compose-ui 1.11 added SemanticsModifierNode.isImportantForBounds() as an abstract method. SentryTagModifierNode was compiled against compose-ui 1.6.x, where the method does not exist, so its bytecode lacks an implementation. When an accessibility client (TalkBack, UiAutomator, adb uiautomator dump) traverses the Compose semantics tree at runtime on 1.11+, the JVM cannot find the method and throws AbstractMethodError. Adding fun isImportantForBounds(): Boolean = false without the override keyword (since the method is absent from the 1.6.x compile-time dependency) places the method in the class bytecode. The JVM satisfies the abstract method requirement via signature matching at runtime. SentryTagModifierNode stores only a semantic tag with no layout/visual effect, so false is the correct return value. * fix formatting * chore(changelog): Add Changelog entry --------- Co-authored-by: Markus Hintersteiner <markus.hintersteiner@sentry.io>
1 parent 0980ed7 commit 30862fc

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Previously, `SentryGestureListener` always started a UI transaction and only afterwards skipped binding it to the Scope when a manually-bound transaction already existed, leaving the new transaction to be dropped as an idle transaction without children.
1313
- Fix potential NPE within `Scope.endSession()` ([#5657](https://github.com/getsentry/sentry-java/pull/5657))
1414
- Fix memory leak in `ReplayIntegration` due to persisting executor not being shut down ([#5627](https://github.com/getsentry/sentry-java/pull/5627))
15+
- Fix AbstractMethodError when compose-ui 1.11+ is used in combination with `Modifier.sentryTag()` or the Sentry Kotlin compiler plugin ([#5672](https://github.com/getsentry/sentry-java/pull/5672))
1516

1617
### Performance
1718

sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryModifier.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,15 @@ public object SentryModifier {
5353
override fun SemanticsPropertyReceiver.applySemantics() {
5454
this[SentryTag] = tag
5555
}
56+
57+
// SemanticsModifierNode.isImportantForBounds() was added as an abstract method in
58+
// compose-ui 1.11. Classes compiled against earlier versions lack this method in
59+
// their bytecode, which causes AbstractMethodError when the accessibility tree is
60+
// traversed on 1.11+ runtimes. We can't use the `override` keyword here because
61+
// the method doesn't exist in the compile-time dependency (compose-ui 1.6.x), but
62+
// the JVM satisfies the abstract-method requirement at runtime via signature
63+
// matching. SentryTagModifierNode only stores a semantic tag and has no visual
64+
// effect on layout, so it is not important for bounds.
65+
@Suppress("unused") fun isImportantForBounds(): Boolean = false
5666
}
5767
}

0 commit comments

Comments
 (0)