Skip to content

Commit 2b592fe

Browse files
authored
fix: Upgrade to Guava 31 and use ImmutableMap.Builder.buildOrThrow() 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
1 parent 33c3b07 commit 2b592fe

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies {
3939
implementation 'com.univocity:univocity-parsers:2.9.0'
4040
implementation 'com.google.code.gson:gson:2.8.6'
4141
implementation 'com.google.geometry:s2-geometry:2.0.0'
42-
implementation 'com.google.guava:guava:29.0-jre'
42+
implementation 'com.google.guava:guava:31.0.1-jre'
4343
implementation 'commons-validator:commons-validator:1.6'
4444
implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.13'
4545
implementation 'com.google.flogger:flogger:0.6'

main/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ dependencies {
8080
implementation 'com.beust:jcommander:1.48'
8181
implementation 'javax.inject:javax.inject:1'
8282
implementation 'com.google.code.gson:gson:2.8.6'
83-
implementation 'com.google.guava:guava:29.0-jre'
83+
implementation 'com.google.guava:guava:31.0.1-jre'
8484
implementation 'com.google.flogger:flogger:0.6'
8585
implementation 'com.google.flogger:flogger-system-backend:0.6'
8686
implementation 'com.univocity:univocity-parsers:2.9.0'

output-comparator/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies {
1717
implementation project(':core')
1818
implementation 'commons-io:commons-io:2.8.0'
1919
implementation 'com.google.api-client:google-api-client:1.31.2'
20-
implementation 'com.google.guava:guava:29.0-jre'
20+
implementation 'com.google.guava:guava:31.0.1-jre'
2121
implementation 'com.google.flogger:flogger:0.5.1'
2222
implementation 'com.google.flogger:flogger-system-backend:0.5.1'
2323
implementation 'com.beust:jcommander:1.48'

processor/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ dependencies {
2020
implementation 'javax.inject:javax.inject:1'
2121
implementation 'com.squareup:javapoet:1.13.0'
2222
implementation 'org.apache.commons:commons-lang3:3.6'
23-
implementation 'com.google.guava:guava:29.0-jre'
23+
implementation 'com.google.guava:guava:31.0.1-jre'
2424
implementation 'com.google.flogger:flogger:0.6'
2525
implementation 'com.univocity:univocity-parsers:2.9.0'
2626
implementation 'com.google.geometry:s2-geometry:2.0.0'

processor/src/main/java/org/mobilitydata/gtfsvalidator/processor/GtfsFileDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public GtfsFileDescriptor build() {
105105
indicesBuilder.add(field);
106106
}
107107
}
108-
ImmutableMap<String, GtfsFieldDescriptor> fieldsMap = fieldsMapBuilder.build();
108+
ImmutableMap<String, GtfsFieldDescriptor> fieldsMap = fieldsMapBuilder.buildOrThrow();
109109
ImmutableList.Builder<LatLonDescriptor> latLonBuilder = ImmutableList.builder();
110110
for (GtfsFieldDescriptor field : fields()) {
111111
if (!field.type().equals(FieldTypeEnum.LATITUDE)) {

0 commit comments

Comments
 (0)