Repository navigation
Fix: remove unnecessary !! operator in generated Kotlin code - #3833
Open
charlie-rbchd wants to merge 2 commits into
Open
charlie-rbchd wants to merge 2 commits into
charlie-rbchd wants to merge 2 commits into
Conversation
oldergod
approved these changes
Nov 30, 2026
| addStatement("%N = %L(initialCapacity)", fieldName, ArrayList::class.simpleName) | ||
| endControlFlow() | ||
| addStatement("%L.tryDecode(reader, %N!!)", adapterName, fieldName) | ||
| addStatement("%L.tryDecode(reader, %N)", adapterName, fieldName) |
Member
There was a problem hiding this comment.
The checked-in golden files still contain the old output. wire-golden-files/src/main/kotlin/squareup/wire/alltypes/AllTypes.kt has tryDecode(reader, pack_int32!!) and 25 similar calls (lines 4012 to 4441), and wire-golden-files/.../repeateddata/ParameterValue.kt:117 has tryDecode(reader, data_!!). CI does not catch this: its dirty-tree check runs after generateTests, which now generates only Swift, so the next local build rewrites these files and leaves an unexplained diff. Regenerate the golden files with ./gradlew :wire-golden-files:build and commit AllTypes.kt and ParameterValue.kt in this PR, as #3533 did.
Author
There was a problem hiding this comment.
Got it! I've regenerated the golden files.
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.
This PR is a follow-up to #3533 (related to #3467).
Some unnecessary double-bangs were left in the generated Kotlin code.
This made the upgrade to Kotlin 2.3 and later impossible for projects that have warning-as-error enabled.