Skip to content

Commit

Permalink
Reference the default nesting limit by name rather than as a constant. (
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonnmcmanus committed Jul 26, 2024
1 parent b6912c2 commit d1badba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gson/src/main/java/com/google/gson/stream/JsonReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public class JsonReader implements Closeable {
private Strictness strictness = Strictness.LEGACY_STRICT;
// Default nesting limit is based on
// https://github.com/square/moshi/blob/parent-1.15.0/moshi/src/main/java/com/squareup/moshi/JsonReader.java#L228-L230
private static final int DEFAULT_NESTING_LIMIT = 255;
static final int DEFAULT_NESTING_LIMIT = 255;
private int nestingLimit = DEFAULT_NESTING_LIMIT;

static final int BUFFER_SIZE = 1024;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ public void testDeeplyNestedObjects() throws IOException {

@Test
public void testNestingLimitDefault() throws IOException {
int defaultLimit = 255;
int defaultLimit = JsonReader.DEFAULT_NESTING_LIMIT;
String json = repeat('[', defaultLimit + 1);
JsonReader reader = new JsonReader(reader(json));
assertThat(reader.getNestingLimit()).isEqualTo(defaultLimit);
Expand Down

0 comments on commit d1badba

Please sign in to comment.