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

Fix code cleanups #1441

Merged
merged 3 commits into from Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -436,7 +436,10 @@ class GeneratedAdaptersTest {
}

@JsonClass(generateAdapter = true)
class ImmutableProperties(val a: Int, val b: Int)
class ImmutableProperties(a: Int, b: Int) {
val a = a
val b = b
}

@Test fun constructorDefaults() {
val moshi = Moshi.Builder().build()
Expand Down
Expand Up @@ -115,7 +115,10 @@ class KotlinJsonAdapterTest {
assertThat(decoded.b).isEqualTo(5)
}

class ImmutableProperties(val a: Int, val b: Int)
class ImmutableProperties(a: Int, b: Int) {
val a = a
val b = b
}

@Test fun constructorDefaults() {
val moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
Expand Down
2 changes: 1 addition & 1 deletion moshi/src/main/java/com/squareup/moshi/Moshi.java
Expand Up @@ -185,7 +185,7 @@ public <T> JsonAdapter<T> nextAdapter(
@CheckReturnValue
public Moshi.Builder newBuilder() {
Builder result = new Builder();
for (int i = 0; i < lastOffset; i++) {
for (int i = 0, limit = lastOffset; i < limit; i++) {
result.add(factories.get(i));
}
for (int i = lastOffset, limit = factories.size() - BUILT_IN_FACTORIES.size(); i < limit; i++) {
Expand Down