diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/OnlyMetricsObservationHandlerGrouping.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/OnlyMetricsObservationHandlerGrouping.java index 9afd302403..32643d521e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/OnlyMetricsObservationHandlerGrouping.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/OnlyMetricsObservationHandlerGrouping.java @@ -38,7 +38,6 @@ import io.micrometer.observation.ObservationRegistry.ObservationConfig; class OnlyMetricsObservationHandlerGrouping implements ObservationHandlerGrouping { @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) public void apply(Collection> handlers, ObservationConfig config) { List> meterObservationHandlers = new ArrayList<>(); for (ObservationHandler handler : handlers) { @@ -49,11 +48,8 @@ class OnlyMetricsObservationHandlerGrouping implements ObservationHandlerGroupin config.observationHandler(handler); } } - - // The ugly raw casts can be removed once - // https://github.com/micrometer-metrics/tracing/issues/27 is resolved if (!meterObservationHandlers.isEmpty()) { - config.observationHandler(new FirstMatchingCompositeObservationHandler((List) meterObservationHandlers)); + config.observationHandler(new FirstMatchingCompositeObservationHandler(meterObservationHandlers)); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/TracingObservationHandlerGrouping.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/TracingObservationHandlerGrouping.java index d03cb5165e..13232ab5b0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/TracingObservationHandlerGrouping.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/TracingObservationHandlerGrouping.java @@ -41,7 +41,6 @@ import io.micrometer.tracing.handler.TracingObservationHandler; class TracingObservationHandlerGrouping implements ObservationHandlerGrouping { @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) public void apply(Collection> handlers, ObservationConfig config) { List> meterObservationHandlers = new ArrayList<>(); List> tracingObservationHandlers = new ArrayList<>(); @@ -56,14 +55,11 @@ class TracingObservationHandlerGrouping implements ObservationHandlerGrouping { config.observationHandler(handler); } } - - // The ugly raw casts can be removed once - // https://github.com/micrometer-metrics/tracing/issues/27 is resolved if (!meterObservationHandlers.isEmpty()) { - config.observationHandler(new FirstMatchingCompositeObservationHandler((List) meterObservationHandlers)); + config.observationHandler(new FirstMatchingCompositeObservationHandler(meterObservationHandlers)); } if (!tracingObservationHandlers.isEmpty()) { - config.observationHandler(new FirstMatchingCompositeObservationHandler((List) tracingObservationHandlers)); + config.observationHandler(new FirstMatchingCompositeObservationHandler(tracingObservationHandlers)); } }