From 0e7c3547dd1db1553d9fba3824ea0bda77076678 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 6 May 2022 11:28:52 +0100 Subject: [PATCH] Prohibit usage of Micrometer nullability annotations Closes gh-30881 --- .../metrics/web/servlet/WebMvcMetricsFilterTests.java | 6 ++---- src/checkstyle/checkstyle.xml | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java index 85d6ab16e7ce..aed02fa87a01 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,6 @@ import io.micrometer.core.instrument.config.MeterFilterReply; import io.micrometer.core.instrument.simple.SimpleConfig; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; -import io.micrometer.core.lang.NonNull; import io.micrometer.prometheus.PrometheusConfig; import io.micrometer.prometheus.PrometheusMeterRegistry; import io.prometheus.client.CollectorRegistry; @@ -357,8 +356,7 @@ PrometheusMeterRegistry prometheus(Clock clock) { clock); r.config().meterFilter(new MeterFilter() { @Override - @NonNull - public MeterFilterReply accept(@NonNull Meter.Id id) { + public MeterFilterReply accept(Meter.Id id) { for (Tag tag : id.getTags()) { if (tag.getKey().equals("uri") && (tag.getValue().contains("histogram") || tag.getValue().contains("percentiles"))) { diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index 90f953dfc567..75cdb251d901 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -13,7 +13,7 @@ name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck"> + value="^sun.*, ^org\.apache\.commons\.(?!compress|dbcp2|logging|pool2).*, ^com\.datastax\.oss\.driver\.shaded.*, ^com\.google\.common.*, ^io\.micrometer\.core\.lang.*, ^io\.micrometer\.shaded.*, ^org\.flywaydb\.core\.internal.*, ^org\.jetbrains\.annotations.*, ^org\.testcontainers\.shaded.*" />