Skip to content

Commit 5d0f484

Browse files
authored
fix: Use ImmutableMap.Bulder.buildOrThrow() instead of build(). (#632)
1 parent ee16bce commit 5d0f484

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

google-cloud-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ public Map<String, Object> getNamedBindings() {
449449
for (Map.Entry<String, Binding> binding : namedBindings.entrySet()) {
450450
builder.put(binding.getKey(), binding.getValue().getCursorOrValue());
451451
}
452-
return builder.build();
452+
return builder.buildOrThrow();
453453
}
454454

455455
/** Returns an immutable list of positional bindings (using original order). */

google-cloud-datastore/src/main/java/com/google/cloud/datastore/ReadOption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ static Map<Class<? extends ReadOption>, ReadOption> asImmutableMap(ReadOption...
6262
for (ReadOption option : options) {
6363
builder.put(option.getClass(), option);
6464
}
65-
return builder.build();
65+
return builder.buildOrThrow();
6666
}
6767
}

google-cloud-datastore/src/main/java/com/google/cloud/datastore/ValueType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public enum ValueType {
7676
builder.put(fieldId, valueType);
7777
}
7878
}
79-
DESCRIPTOR_TO_TYPE_MAP = builder.build();
79+
DESCRIPTOR_TO_TYPE_MAP = builder.buildOrThrow();
8080
}
8181

8282
<V, P extends Value<V>, B extends ValueBuilder<V, P, B>> ValueType(

google-cloud-datastore/src/test/java/com/google/cloud/datastore/ValueTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class ValueTest {
5858
.put(ValueType.RAW_VALUE, new Object[] {RawValue.class, RAW_VALUE.get()})
5959
.put(ValueType.LAT_LNG, new Object[] {LatLngValue.class, LAT_LNG_VALUE.get()})
6060
.put(ValueType.STRING, new Object[] {StringValue.class, STRING_VALUE.get()})
61-
.build();
61+
.buildOrThrow();
6262

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

@@ -110,7 +110,7 @@ public void setUp() throws Exception {
110110
assertTrue("Could not find an of method for " + valueClass, found);
111111
}
112112
}
113-
typeToValue = builder.build();
113+
typeToValue = builder.buildOrThrow();
114114
}
115115

116116
@Test

0 commit comments

Comments
 (0)