Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert JsonReader to Kotlin #1505

Merged
merged 8 commits into from
Jan 17, 2022
Merged

Convert JsonReader to Kotlin #1505

merged 8 commits into from
Jan 17, 2022

Conversation

ZacSweers
Copy link
Collaborator

Made it sealed along the way like JsonWriter

Some of the properties had different docs for setting and getting, which dokka doesn't seem to have a nice way to differentiate. Went with a little marked up form but open to suggestions.

Made it sealed along the way like JsonWriter

Some of the properties had different docs for setting and getting, which dokka doesn't seem to have a nice way to differentiate. Went with a little marked up form but open to suggestions.
This plays nice for both java and kotlin consumers, as it's still isLenient to java consumers but not a source breaking change for kotlin
moshi/src/main/java/com/squareup/moshi/JsonReader.kt Outdated Show resolved Hide resolved
Comment on lines +586 to +590
return buildList(strings.size) {
for (string in strings) {
add(string)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't you just say strings.toList() or strings.map { it }?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection builders return (truly) immutable instances

@ZacSweers ZacSweers merged commit 47697c2 into master Jan 17, 2022
@ZacSweers ZacSweers deleted the z/kotlinJsonReader branch January 17, 2022 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants