Skip to content

Commit

Permalink
Fix android desugaring for HashMap.forEach (open-telemetry#5468)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored and RashmiRam committed May 23, 2022
1 parent 8d1498a commit a8ea7cb
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.opentelemetry.api.common.AttributesBuilder;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;

/**
* The {@link AttributesBuilder} and {@link Attributes} used by the instrumentation API. We are able
Expand Down Expand Up @@ -68,4 +69,12 @@ public AttributesBuilder putAll(Attributes attributes) {
attributes.forEach(this::put);
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);
}
}

0 comments on commit a8ea7cb

Please sign in to comment.