Fix android desugaring for HashMap.forEach (#5468)
This commit is contained in:
parent
96906741c3
commit
c8c115d13f
|
@ -10,6 +10,7 @@ import io.opentelemetry.api.common.Attributes;
|
||||||
import io.opentelemetry.api.common.AttributesBuilder;
|
import io.opentelemetry.api.common.AttributesBuilder;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link AttributesBuilder} and {@link Attributes} used by the instrumentation API. We are able
|
* The {@link AttributesBuilder} and {@link Attributes} used by the instrumentation API. We are able
|
||||||
|
@ -68,4 +69,12 @@ final class UnsafeAttributes extends HashMap<AttributeKey<?>, Object>
|
||||||
attributes.forEach(this::put);
|
attributes.forEach(this::put);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEach(BiConsumer<? super AttributeKey<?>, ? super Object> action) {
|
||||||
|
// https://github.com/open-telemetry/opentelemetry-java/issues/4161
|
||||||
|
// Help out android desugaring by having an explicit call to HashMap.forEach, when forEach is
|
||||||
|
// just called through Attributes.forEach desugaring is unable to correctly handle it.
|
||||||
|
super.forEach(action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue