From a0e9f6e5b6816d54bb2425467c18d446e9ed5050 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 11 Nov 2026 12:49:16 +0100 Subject: [PATCH 1/2] fix: Annotate nullable array returns on the array, not the element JetBrains @Nullable is a TYPE_USE annotation, so @Nullable byte[] marks the element type and Kotlin saw ByteArray instead of ByteArray?. Moving it to byte @Nullable [] makes Kotlin see the nullable return. Co-Authored-By: Claude Opus 5.5 --- .../src/main/java/io/sentry/android/core/ContextUtils.java | 2 +- sentry/src/main/java/io/sentry/Attachment.java | 2 +- sentry/src/main/java/io/sentry/cache/tape/QueueFile.java | 2 +- sentry/src/main/java/io/sentry/protocol/Device.java | 2 +- sentry/src/main/java/io/sentry/protocol/Spring.java | 2 +- sentry/src/main/java/io/sentry/util/JsonSerializationUtils.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ContextUtils.java b/sentry-android-core/src/main/java/io/sentry/android/core/ContextUtils.java index b71c3628c6e..f44e90741b2 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ContextUtils.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ContextUtils.java @@ -81,7 +81,7 @@ public boolean isSplitApks() { return isSplitApks; } - public @Nullable String[] getSplitNames() { + public String @Nullable [] getSplitNames() { return splitNames; } } diff --git a/sentry/src/main/java/io/sentry/Attachment.java b/sentry/src/main/java/io/sentry/Attachment.java index 3e4cb859e5e..ead6fd1e79d 100644 --- a/sentry/src/main/java/io/sentry/Attachment.java +++ b/sentry/src/main/java/io/sentry/Attachment.java @@ -283,7 +283,7 @@ public Attachment( * * @return the bytes. */ - public @Nullable byte[] getBytes() { + public byte @Nullable [] getBytes() { return bytes; } diff --git a/sentry/src/main/java/io/sentry/cache/tape/QueueFile.java b/sentry/src/main/java/io/sentry/cache/tape/QueueFile.java index 137f1cd9156..0e9454f96a5 100644 --- a/sentry/src/main/java/io/sentry/cache/tape/QueueFile.java +++ b/sentry/src/main/java/io/sentry/cache/tape/QueueFile.java @@ -529,7 +529,7 @@ private void setLength(long newLength) throws IOException { } /** Reads the eldest element. Returns null if the queue is empty. */ - public @Nullable byte[] peek() throws IOException { + public byte @Nullable [] peek() throws IOException { if (closed) throw new IllegalStateException("closed"); if (isEmpty()) return null; int length = first.length; diff --git a/sentry/src/main/java/io/sentry/protocol/Device.java b/sentry/src/main/java/io/sentry/protocol/Device.java index 8704c2220f0..cf88201e232 100644 --- a/sentry/src/main/java/io/sentry/protocol/Device.java +++ b/sentry/src/main/java/io/sentry/protocol/Device.java @@ -383,7 +383,7 @@ public void setTimezone(final @Nullable TimeZone timezone) { this.timezone = timezone; } - public @Nullable String[] getArchs() { + public String @Nullable [] getArchs() { return archs; } diff --git a/sentry/src/main/java/io/sentry/protocol/Spring.java b/sentry/src/main/java/io/sentry/protocol/Spring.java index 849b05168e3..c2a8ace6f91 100644 --- a/sentry/src/main/java/io/sentry/protocol/Spring.java +++ b/sentry/src/main/java/io/sentry/protocol/Spring.java @@ -35,7 +35,7 @@ public Spring(final @NotNull Spring spring) { this.unknown = CollectionUtils.newConcurrentHashMap(spring.unknown); } - public @Nullable String[] getActiveProfiles() { + public String @Nullable [] getActiveProfiles() { return activeProfiles; } diff --git a/sentry/src/main/java/io/sentry/util/JsonSerializationUtils.java b/sentry/src/main/java/io/sentry/util/JsonSerializationUtils.java index 4e5f9be90e5..95c606837a3 100644 --- a/sentry/src/main/java/io/sentry/util/JsonSerializationUtils.java +++ b/sentry/src/main/java/io/sentry/util/JsonSerializationUtils.java @@ -48,7 +48,7 @@ public final class JsonSerializationUtils { return list; } - public static @Nullable byte[] bytesFrom( + public static byte @Nullable [] bytesFrom( final @NotNull ISerializer serializer, final @NotNull ILogger logger, final @NotNull JsonSerializable serializable) { From 70090b1c5b5e5ad00e6d50d3d367a6b120260188 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 11 Nov 2026 12:49:56 +0100 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3243f9991b..d1b38df8e6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ ### Fixes +- Kotlin now sees `Attachment.getBytes()`, `Device.getArchs()`, `Spring.getActiveProfiles()` and `JsonSerializationUtils.bytesFrom(...)` as nullable, because `@Nullable` now annotates the returned array instead of its elements ([#6558](https://github.com/getsentry/sentry-java/pull/6558)) - Capture scroll breadcrumbs for `LazyColumn`, `LazyRow`, lazy grids, and `Pager` on Jetpack Compose foundation 1.10+ ([#6548](https://github.com/getsentry/sentry-java/pull/6548)) - Prevent the main thread from potentially hanging during app start if Android is slow to register the SDK's network or telephony listeners. `Sentry.init`, Session Replay, and capturing events no longer wait for that registration ([#6537](https://github.com/getsentry/sentry-java/pull/6537)) - Add opt-in support for matching GraphQL ignored error types against classification specifications via `sentry.graphql.enable-specification-error-type-filtering` ([#6092](https://github.com/getsentry/sentry-java/pull/6092))