Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excavator: Upgrades Baseline to the latest version #1590

Merged
merged 2 commits into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
dependencies {
classpath 'com.palantir.gradle.jdks:gradle-jdks:0.27.0'
classpath 'com.palantir.gradle.jdkslatest:gradle-jdks-latest:0.4.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.178.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.179.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.11.0'
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.11.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.15.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public final class InternalCacheMetrics {
private InternalCacheMetrics() {}

public static <K> ImmutableMap<K, Gauge<?>> createMetrics(Stats stats, Function<String, K> metricNamer) {
ImmutableMap.Builder<K, Gauge<?>> builder = ImmutableMap.builder();
ImmutableMap.Builder<K, Gauge<?>> builder = ImmutableMap.builderWithExpectedSize(12);
stats.forEach((name, gauge) -> builder.put(metricNamer.apply(name), gauge));
return builder.build();
return builder.buildOrThrow();
schlosna marked this conversation as resolved.
Show resolved Hide resolved
}

@SuppressWarnings("NoFunctionalReturnType")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ void testRegisterAll() {
.put("counter", counter)
.put("timer", timer)
.put("set", (MetricSet) () -> ImmutableMap.of("gauge", gauge))
.build();
.buildOrThrow();
MetricRegistries.registerAll(registry, "tritium", metricSet);
assertThat(registry.getMetrics())
.containsExactlyInAnyOrderEntriesOf(ImmutableMap.<MetricName, Metric>builder()
Expand All @@ -505,7 +505,7 @@ void testRegisterAll() {
.put(simpleName("tritium.counter"), counter)
.put(simpleName("tritium.timer"), timer)
.put(simpleName("tritium.set.gauge"), gauge)
.build());
.buildOrThrow());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public MetricName.Builder putAllSafeTags(@Safe Map<@Safe String, @Safe ? extends
: TagMap.of(ImmutableMap.<String, String>builderWithExpectedSize(tagMap.size() + entries.size())
.putAll(tagMap)
.putAll(entries)
.build());
.buildKeepingLast());
}
return (MetricName.Builder) this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ private static TagMap withEntryFallback(SortedMap<String, String> tags, String e
return TagMap.of(ImmutableSortedMap.<String, String>naturalOrder()
.putAll(tags)
.put(extraTagName, extraTagValue)
.build());
.buildOrThrow());
schlosna marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void check_TagMap_has_the_same_behaviour_as_an_ImmutableSortedMap_with_an_extra_
ImmutableSortedMap<String, String> guavaWithExtra = ImmutableSortedMap.<String, String>naturalOrder()
.putAll(base)
.put(extraKey, extraValue)
.build();
.buildOrThrow();

SortedMap<String, String> extraMap = TagMap.of(base).withEntry(extraKey, extraValue);

Expand All @@ -84,7 +84,7 @@ void check_TagMap_has_the_same_behaviour_as_an_ImmutableSortedMap_with_an_extra_
.put("keySet", SortedMap::keySet)
.put("entrySet", SortedMap::entrySet)
.put("values", shortByteSortedMap -> ImmutableList.copyOf(shortByteSortedMap.values()))
.build();
.buildOrThrow();

methodCalls.forEach((methodCallName, methodCall) -> {
assertThat(methodCall.apply(extraMap))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void testNaturalOrder() {
Comparator<?> immutableSortedMapComparator = ImmutableSortedMap.naturalOrder()
.put("a", "b")
.put("c", "d")
.build()
.buildOrThrow()
.comparator();
assertThat(TagMap.isNaturalOrder(immutableSortedMapComparator))
.as("Expected ImmutableSortedMap comparator %s to be natural", immutableSortedMapComparator)
Expand Down