Repository navigation
fix: Annotate nullable array returns on the array, not the element - #6558
Open
runningcode wants to merge 2 commits into
Open
runningcode wants to merge 2 commits into
runningcode wants to merge 2 commits into
Conversation
📲 Install BuildsAndroid
|
runningcode
marked this pull request as ready for review
November 11, 2026 14:28
runningcode
requested review from
0xadam-brown and
markushi
and removed request for
a team
November 11, 2026 14:28
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Moves the JetBrains
@Nullablefrom the element type to the array on six public methods that return a nullable array:Attachment.getBytes()Device.getArchs()Spring.getActiveProfiles()ContextUtils.getSplitNames()JsonSerializationUtils.bytesFrom(...)QueueFile.peek()💡 Motivation and Context
JetBrains
@Nullableis aTYPE_USEannotation, so@Nullable byte[]marks the element type, not the array. Kotlin saw these returns asByteArrayandArray<String>, although they can return null. Withbyte @Nullable []Kotlin seesByteArray?andArray<String>?.Follow-up to the review on #6497, which fixed the same thing on
ViewHierarchyEventProcessor.snapshotViewHierarchyAsData. TheScreenshotUtilsreturns useandroidx.annotation.Nullable, a declaration annotation that Kotlin already reads as a nullable return, so they stay as they are.💚 How did you test it?
A Kotlin assignment of each kind of return to a non-null type now fails to compile. The Kotlin tests of the modules that call these methods still compile, and their unit tests pass.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Kotlin code that uses these returns as non-null, for example
attachment.bytes.size, no longer compiles until it handles null.🤖 Generated with Claude Code