Skip to content

Commit

Permalink
Excavator: Upgrades Baseline to the latest version (#1409)
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot authored Mar 29, 2022
1 parent bf6e5ce commit e1a6c0e
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 21 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
}

dependencies {
classpath 'com.google.errorprone:error_prone_core:2.10.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.81.0'
classpath 'com.google.errorprone:error_prone_core:2.11.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.82.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.9.0'
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.11.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.14.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import com.codahale.metrics.Gauge;
import com.github.benmanes.caffeine.cache.Cache;
import com.google.common.collect.ImmutableMap;
import com.palantir.tritium.metrics.registry.MetricName;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
Expand All @@ -34,7 +34,7 @@ final class CaffeineCacheTaggedMetricsTest {
void createMetrics(@Mock Cache<?, ?> cache) {
CaffeineCacheTaggedMetrics cacheTaggedMetrics = CaffeineCacheTaggedMetrics.create(cache, "test");
assertThat(cacheTaggedMetrics).isNotNull();
Map<MetricName, Gauge<?>> metrics = cacheTaggedMetrics.getMetrics();
ImmutableMap<MetricName, Gauge<?>> metrics = cacheTaggedMetrics.getMetrics();
assertThat(metrics).hasSize(12);
assertThat(metrics.keySet())
.extracting(MetricName::safeName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private static Map<String, String> instrumentationProperties() {
return instrumentationProperties.get();
}

private static Map<String, String> createInstrumentationSystemProperties() {
private static ImmutableMap<String, String> createInstrumentationSystemProperties() {
/*
* Since system properties are backed by a java.util.Hashtable, they can be
* a point of contention as all access is synchronized. We therefore take
Expand All @@ -106,7 +106,7 @@ private static Map<String, String> createInstrumentationSystemProperties() {
@SuppressWarnings("unchecked")
Map<Object, Object> clonedSystemProperties =
(Map<Object, Object>) System.getProperties().clone();
Map<String, String> map = clonedSystemProperties.entrySet().stream()
ImmutableMap<String, String> map = clonedSystemProperties.entrySet().stream()
.filter(entry -> entry.getKey() instanceof String
&& entry.getValue() instanceof String
&& String.valueOf(entry.getKey()).startsWith(INSTRUMENT_PREFIX))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void invalid() {
@Test
void racingSystemProperties() throws Exception {
CyclicBarrier barrier = new CyclicBarrier(8);
List<Callable<Object>> tasks = ImmutableList.of(
ImmutableList<Callable<Object>> tasks = ImmutableList.of(
() -> {
barrier.await();
return "getSystemPropertySupplier: "
Expand Down
11 changes: 5 additions & 6 deletions tritium-lib/src/test/java/com/palantir/tritium/Tagged.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.palantir.tritium.metrics.registry.TaggedMetricRegistry;
import java.util.Comparator;
import java.util.Map;
import java.util.SortedMap;

public final class Tagged {
private Tagged() {}
Expand All @@ -50,11 +49,11 @@ public static void report(ConsoleReporter reporter, TaggedMetricRegistry taggedM
if (!metrics.isEmpty()) {
System.out.println("Tagged Metrics:");
@SuppressWarnings("rawtypes")
SortedMap<String, Gauge> gauges = filter(metrics, Gauge.class);
SortedMap<String, Counter> counters = filter(metrics, Counter.class);
SortedMap<String, Histogram> histograms = filter(metrics, Histogram.class);
SortedMap<String, Meter> meters = filter(metrics, Meter.class);
SortedMap<String, Timer> timers = filter(metrics, Timer.class);
ImmutableSortedMap<String, Gauge> gauges = filter(metrics, Gauge.class);
ImmutableSortedMap<String, Counter> counters = filter(metrics, Counter.class);
ImmutableSortedMap<String, Histogram> histograms = filter(metrics, Histogram.class);
ImmutableSortedMap<String, Meter> meters = filter(metrics, Meter.class);
ImmutableSortedMap<String, Timer> timers = filter(metrics, Timer.class);
reporter.report(gauges, counters, histograms, meters, timers);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.google.common.base.Strings;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.errorprone.annotations.CheckReturnValue;
import com.palantir.logsafe.Preconditions;
import com.palantir.logsafe.Safe;
import com.palantir.logsafe.SafeArg;
Expand All @@ -58,7 +59,6 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.mockito.Mockito.when;

import com.codahale.metrics.Gauge;
import com.google.common.collect.ImmutableMap;
import com.palantir.tritium.metrics.registry.MetricName;
import java.util.Map;
import java.util.Optional;
Expand All @@ -38,7 +39,7 @@ final class InternalCacheMetricsTest {

@Test
void createMetrics() {
Map<String, Gauge<?>> metrics = InternalCacheMetrics.createMetrics(emptyStats(), Function.identity());
ImmutableMap<String, Gauge<?>> metrics = InternalCacheMetrics.createMetrics(emptyStats(), Function.identity());
assertThat(metrics)
.containsOnlyKeys(
"cache.estimated.size",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void testCheckAreAllInterfaces() {

@Test
void testCheckAreAllInterfacesWithClass() {
List<Class<?>> interfaces =
ImmutableList<Class<?>> interfaces =
ImmutableList.of(TestInterface.class, String.class, Runnable.class, Callable.class, List.class);
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> Proxies.checkAreAllInterfaces(interfaces));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ public boolean containsValue(Object value) {
return false;
}

@Nullable
@Override
public String put(String _key, String _value) {
throw new UnsupportedOperationException("immutable");
Expand All @@ -318,6 +319,7 @@ public void putAll(@Nonnull Map<? extends String, ? extends String> _map) {
throw new UnsupportedOperationException("immutable");
}

@Nullable
@Override
public String remove(Object _key) {
throw new UnsupportedOperationException("immutable");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void check_TagMap_has_the_same_behaviour_as_an_ImmutableSortedMap_with_an_extra_
Assume.that(paramKeyIndex1 < initialValues.size());
Assume.that(paramKeyIndex2 < initialValues.size());

SortedMap<String, String> base = ImmutableSortedMap.copyOf(initialValues);
ImmutableSortedMap<String, String> base = ImmutableSortedMap.copyOf(initialValues);

SortedMap<String, String> guavaWithExtra = ImmutableSortedMap.<String, String>naturalOrder()
ImmutableSortedMap<String, String> guavaWithExtra = ImmutableSortedMap.<String, String>naturalOrder()
.putAll(base)
.put(extraKey, extraValue)
.build();
Expand All @@ -69,7 +69,7 @@ void check_TagMap_has_the_same_behaviour_as_an_ImmutableSortedMap_with_an_extra_
String paramValue1 = guavaWithExtra.get(paramKey1);
String paramKey2 = Iterables.get(guavaWithExtra.keySet(), paramKeyIndex2);

Map<String, Function<SortedMap<String, String>, Object>> methodCalls =
ImmutableMap<String, Function<SortedMap<String, String>, Object>> methodCalls =
ImmutableMap.<String, Function<SortedMap<String, String>, Object>>builder()
.put("subMap", sortedMap -> sortedMap.subMap(paramKey1, paramKey2))
.put("headMap", sortedMap -> sortedMap.headMap(paramKey1))
Expand Down
2 changes: 1 addition & 1 deletion versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
com.github.ben-manes.caffeine:caffeine:3.0.6 (1 constraints: 0b050036)
com.google.auto.service:auto-service-annotations:1.0.1 (1 constraints: 0405f135)
com.google.code.findbugs:jsr305:3.0.2 (4 constraints: 5c3586ed)
com.google.errorprone:error_prone_annotations:2.11.0 (8 constraints: af7039d8)
com.google.errorprone:error_prone_annotations:2.11.0 (9 constraints: e475c5d9)
com.google.guava:failureaccess:1.0.1 (1 constraints: 140ae1b4)
com.google.guava:guava:31.1-jre (5 constraints: 6d424836)
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava (1 constraints: bd17c918)
Expand Down
2 changes: 1 addition & 1 deletion versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ com.fasterxml.jackson.*:* = 2.13.2
com.github.ben-manes.caffeine:caffeine = 3.0.6
com.google.auto:* = 1.2.1
com.google.auto.service:* = 1.0.1
com.google.code.findbugs:jFormatString = 3.0.0
com.google.code.findbugs:jsr305 = 3.0.2
com.google.errorprone:* = 2.11.0
com.google.guava:guava = 31.1-jre
com.google.testing.compile:compile-testing = 0.19
com.palantir.goethe:* = 0.7.0
Expand Down

0 comments on commit e1a6c0e

Please sign in to comment.