From 4c7050f8098cbedaf17fe02c59ffeae8780fc4de Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Wed, 25 Sep 2024 01:13:27 +0200 Subject: [PATCH] Make Map generator more type-safe --- .../test/java/com/google/gson/JsonObjectAsMapSuiteTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gson/src/test/java/com/google/gson/JsonObjectAsMapSuiteTest.java b/gson/src/test/java/com/google/gson/JsonObjectAsMapSuiteTest.java index bbaa6cb74b..c2fc8c73f8 100644 --- a/gson/src/test/java/com/google/gson/JsonObjectAsMapSuiteTest.java +++ b/gson/src/test/java/com/google/gson/JsonObjectAsMapSuiteTest.java @@ -35,9 +35,8 @@ public SampleElements> samples() { public Map create(Object... elements) { JsonObject object = new JsonObject(); for (Object element : elements) { - @SuppressWarnings("unchecked") - var entry = (Entry) element; - object.add(entry.getKey(), entry.getValue()); + var entry = (Entry) element; + object.add((String) entry.getKey(), (JsonElement) entry.getValue()); } return object.asMap(); }