From d3c9bea0a391392f14c1385e2d7d62e8a0264a00 Mon Sep 17 00:00:00 2001 From: Carter Kozak Date: Mon, 11 Apr 2022 09:35:30 -0400 Subject: [PATCH 1/2] Additional safe-logging annotations on type variables From https://github.com/palantir/safe-logging/pull/699 --- .../tritium/metrics/registry/ImmutableMetricName.java | 6 +++--- .../com/palantir/tritium/metrics/registry/MetricName.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/ImmutableMetricName.java b/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/ImmutableMetricName.java index efcf8fab4..3743a300e 100644 --- a/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/ImmutableMetricName.java +++ b/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/ImmutableMetricName.java @@ -60,7 +60,7 @@ public MetricName.Builder putSafeTags(@Safe String key, @Safe String value) { } @CanIgnoreReturnValue - public MetricName.Builder putSafeTags(@Safe Map.Entry entry) { + public MetricName.Builder putSafeTags(@Safe Map.Entry<@Safe String, @Safe ? extends String> entry) { Preconditions.checkNotNull(entry, "entry"); tagMap = tagMap.withEntry(entry.getKey(), entry.getValue()); return (MetricName.Builder) this; @@ -68,7 +68,7 @@ public MetricName.Builder putSafeTags(@Safe Map.Entry @SuppressWarnings("unchecked") @CanIgnoreReturnValue - public MetricName.Builder safeTags(@Safe Map entries) { + public MetricName.Builder safeTags(@Safe Map<@Safe String, @Safe ? extends String> entries) { Preconditions.checkNotNull(entries, "entries"); tagMap = TagMap.of((Map) entries); return (MetricName.Builder) this; @@ -76,7 +76,7 @@ public MetricName.Builder safeTags(@Safe Map entries) @SuppressWarnings("unchecked") @CanIgnoreReturnValue - public MetricName.Builder putAllSafeTags(@Safe Map entries) { + public MetricName.Builder putAllSafeTags(@Safe Map<@Safe String, @Safe ? extends String> entries) { Preconditions.checkNotNull(entries, "entries"); if (!entries.isEmpty()) { tagMap = tagMap.isEmpty() diff --git a/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/MetricName.java b/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/MetricName.java index 65b2b8e56..7ddcf771b 100644 --- a/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/MetricName.java +++ b/tritium-registry/src/main/java/com/palantir/tritium/metrics/registry/MetricName.java @@ -36,7 +36,7 @@ public interface MetricName { *

All tags and keys must be {@link Safe} to log. */ @Safe - SortedMap safeTags(); + SortedMap<@Safe String, @Safe String> safeTags(); static Builder builder() { return new Builder(); From a5e4f63b61413989b7158dfd5994a1752d5ced20 Mon Sep 17 00:00:00 2001 From: svc-changelog Date: Mon, 11 Apr 2022 13:38:21 +0000 Subject: [PATCH 2/2] Add generated changelog entries --- changelog/@unreleased/pr-1437.v2.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/@unreleased/pr-1437.v2.yml diff --git a/changelog/@unreleased/pr-1437.v2.yml b/changelog/@unreleased/pr-1437.v2.yml new file mode 100644 index 000000000..004b2b56c --- /dev/null +++ b/changelog/@unreleased/pr-1437.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Additional safe-logging annotations on type variables + links: + - https://github.com/palantir/tritium/pull/1437