Skip to content

Commit

Permalink
fix: Use ImmutableMap.Bulder.buildOrThrow() instead of build(). (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcostell authored Feb 15, 2022
1 parent ee16bce commit 5d0f484
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public Map<String, Object> getNamedBindings() {
for (Map.Entry<String, Binding> binding : namedBindings.entrySet()) {
builder.put(binding.getKey(), binding.getValue().getCursorOrValue());
}
return builder.build();
return builder.buildOrThrow();
}

/** Returns an immutable list of positional bindings (using original order). */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ static Map<Class<? extends ReadOption>, ReadOption> asImmutableMap(ReadOption...
for (ReadOption option : options) {
builder.put(option.getClass(), option);
}
return builder.build();
return builder.buildOrThrow();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public enum ValueType {
builder.put(fieldId, valueType);
}
}
DESCRIPTOR_TO_TYPE_MAP = builder.build();
DESCRIPTOR_TO_TYPE_MAP = builder.buildOrThrow();
}

<V, P extends Value<V>, B extends ValueBuilder<V, P, B>> ValueType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ValueTest {
.put(ValueType.RAW_VALUE, new Object[] {RawValue.class, RAW_VALUE.get()})
.put(ValueType.LAT_LNG, new Object[] {LatLngValue.class, LAT_LNG_VALUE.get()})
.put(ValueType.STRING, new Object[] {StringValue.class, STRING_VALUE.get()})
.build();
.buildOrThrow();

private ImmutableMap<ValueType, Value<?>> typeToValue;

Expand Down Expand Up @@ -110,7 +110,7 @@ public void setUp() throws Exception {
assertTrue("Could not find an of method for " + valueClass, found);
}
}
typeToValue = builder.build();
typeToValue = builder.buildOrThrow();
}

@Test
Expand Down

0 comments on commit 5d0f484

Please sign in to comment.