Skip to content

Commit

Permalink
fix: Upgrade to Guava 31 and use `ImmutableMap.Builder.buildOrThrow()…
Browse files Browse the repository at this point in the history
…` instead of `build()` (#1103)

ImmutableMap.Builder.build() throws if the same key was added to the builder twice. There were thousands of bugs because many people are not aware of that. The `build()` method is deprecated in Guava 31 and replaced by `buildOrThrow()` with the same behaviour.

See also: google/guava@4b9c269
  • Loading branch information
aababilov authored Feb 10, 2022
1 parent 33c3b07 commit 2b592fe
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies {
implementation 'com.univocity:univocity-parsers:2.9.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.geometry:s2-geometry:2.0.0'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'commons-validator:commons-validator:1.6'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.13'
implementation 'com.google.flogger:flogger:0.6'
Expand Down
2 changes: 1 addition & 1 deletion main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ dependencies {
implementation 'com.beust:jcommander:1.48'
implementation 'javax.inject:javax.inject:1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'com.google.flogger:flogger:0.6'
implementation 'com.google.flogger:flogger-system-backend:0.6'
implementation 'com.univocity:univocity-parsers:2.9.0'
Expand Down
2 changes: 1 addition & 1 deletion output-comparator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies {
implementation project(':core')
implementation 'commons-io:commons-io:2.8.0'
implementation 'com.google.api-client:google-api-client:1.31.2'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'com.google.flogger:flogger:0.5.1'
implementation 'com.google.flogger:flogger-system-backend:0.5.1'
implementation 'com.beust:jcommander:1.48'
Expand Down
2 changes: 1 addition & 1 deletion processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies {
implementation 'javax.inject:javax.inject:1'
implementation 'com.squareup:javapoet:1.13.0'
implementation 'org.apache.commons:commons-lang3:3.6'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'com.google.flogger:flogger:0.6'
implementation 'com.univocity:univocity-parsers:2.9.0'
implementation 'com.google.geometry:s2-geometry:2.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public GtfsFileDescriptor build() {
indicesBuilder.add(field);
}
}
ImmutableMap<String, GtfsFieldDescriptor> fieldsMap = fieldsMapBuilder.build();
ImmutableMap<String, GtfsFieldDescriptor> fieldsMap = fieldsMapBuilder.buildOrThrow();
ImmutableList.Builder<LatLonDescriptor> latLonBuilder = ImmutableList.builder();
for (GtfsFieldDescriptor field : fields()) {
if (!field.type().equals(FieldTypeEnum.LATITUDE)) {
Expand Down

0 comments on commit 2b592fe

Please sign in to comment.