Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Allow injecting into maps of type Map<String,Object> (#310)
Browse files Browse the repository at this point in the history
* Allow injecting into maps of type Map<String,Object>

For the inject case, it doesn’t matter so much that the generic type is declared as String.

* Modify generic type on map in test.
  • Loading branch information
tylerbenson authored and yurishkuro committed Oct 19, 2018
1 parent bffd9b6 commit b6f6324
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
* @see Tracer#inject(SpanContext, Format, Object)
*/
public final class TextMapInjectAdapter implements TextMap {
private final Map<String,String> map;
private final Map<String, ? super String> map;

public TextMapInjectAdapter(final Map<String,String> map) {
public TextMapInjectAdapter(final Map<String, ? super String> map) {
this.map = map;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TextMapInjectAdapterTest {

@Test
public void testPut() {
Map<String, String> headers = new LinkedHashMap<String, String>();
Map<String, Object> headers = new LinkedHashMap<String, Object>();
TextMapInjectAdapter injectAdapter = new TextMapInjectAdapter(headers);
injectAdapter.put("foo", "bar");

Expand Down

0 comments on commit b6f6324

Please sign in to comment.