Remove unchecked raw casts that are now redundant

Closes gh-31326
pull/31663/head
Andy Wilkinson 2 years ago
parent f83f1a5fff
commit 2821629d54

@ -38,7 +38,6 @@ import io.micrometer.observation.ObservationRegistry.ObservationConfig;
class OnlyMetricsObservationHandlerGrouping implements ObservationHandlerGrouping { class OnlyMetricsObservationHandlerGrouping implements ObservationHandlerGrouping {
@Override @Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void apply(Collection<ObservationHandler<?>> handlers, ObservationConfig config) { public void apply(Collection<ObservationHandler<?>> handlers, ObservationConfig config) {
List<ObservationHandler<?>> meterObservationHandlers = new ArrayList<>(); List<ObservationHandler<?>> meterObservationHandlers = new ArrayList<>();
for (ObservationHandler<?> handler : handlers) { for (ObservationHandler<?> handler : handlers) {
@ -49,11 +48,8 @@ class OnlyMetricsObservationHandlerGrouping implements ObservationHandlerGroupin
config.observationHandler(handler); config.observationHandler(handler);
} }
} }
// The ugly raw casts can be removed once
// https://github.com/micrometer-metrics/tracing/issues/27 is resolved
if (!meterObservationHandlers.isEmpty()) { if (!meterObservationHandlers.isEmpty()) {
config.observationHandler(new FirstMatchingCompositeObservationHandler((List) meterObservationHandlers)); config.observationHandler(new FirstMatchingCompositeObservationHandler(meterObservationHandlers));
} }
} }

@ -41,7 +41,6 @@ import io.micrometer.tracing.handler.TracingObservationHandler;
class TracingObservationHandlerGrouping implements ObservationHandlerGrouping { class TracingObservationHandlerGrouping implements ObservationHandlerGrouping {
@Override @Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void apply(Collection<ObservationHandler<?>> handlers, ObservationConfig config) { public void apply(Collection<ObservationHandler<?>> handlers, ObservationConfig config) {
List<ObservationHandler<?>> meterObservationHandlers = new ArrayList<>(); List<ObservationHandler<?>> meterObservationHandlers = new ArrayList<>();
List<ObservationHandler<?>> tracingObservationHandlers = new ArrayList<>(); List<ObservationHandler<?>> tracingObservationHandlers = new ArrayList<>();
@ -56,14 +55,11 @@ class TracingObservationHandlerGrouping implements ObservationHandlerGrouping {
config.observationHandler(handler); config.observationHandler(handler);
} }
} }
// The ugly raw casts can be removed once
// https://github.com/micrometer-metrics/tracing/issues/27 is resolved
if (!meterObservationHandlers.isEmpty()) { if (!meterObservationHandlers.isEmpty()) {
config.observationHandler(new FirstMatchingCompositeObservationHandler((List) meterObservationHandlers)); config.observationHandler(new FirstMatchingCompositeObservationHandler(meterObservationHandlers));
} }
if (!tracingObservationHandlers.isEmpty()) { if (!tracingObservationHandlers.isEmpty()) {
config.observationHandler(new FirstMatchingCompositeObservationHandler((List) tracingObservationHandlers)); config.observationHandler(new FirstMatchingCompositeObservationHandler(tracingObservationHandlers));
} }
} }

Loading…
Cancel
Save