aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-testing-harness
diff options
context:
space:
mode:
authorMarcono1234 <Marcono1234@users.noreply.github.com>2024-01-24 00:59:14 +0100
committersonartech <sonartech@sonarsource.com>2024-01-29 20:03:17 +0000
commit29994d2a4ffa03fa205d7ed674cc29cc2efb5edb (patch)
tree7f26e12601a0764ada8a25e87c6f6870e2195bc6 /sonar-testing-harness
parentae627711c4596d6b411c35fbcc163952f77bc63e (diff)
downloadsonarqube-29994d2a4ffa03fa205d7ed674cc29cc2efb5edb.tar.gz
sonarqube-29994d2a4ffa03fa205d7ed674cc29cc2efb5edb.zip
NO-JIRA Make Gson usage more type-safe
Uses `Gson.fromJson(..., TypeToken<T>)` instead of `fromJson(..., Type)` Also replaces some usage of the deprecated `JsonParser()` constructor.
Diffstat (limited to 'sonar-testing-harness')
-rw-r--r--sonar-testing-harness/src/main/java/org/sonar/test/JsonAssert.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/JsonAssert.java b/sonar-testing-harness/src/main/java/org/sonar/test/JsonAssert.java
index 299bbc9ceeb..a24ca30b8e0 100644
--- a/sonar-testing-harness/src/main/java/org/sonar/test/JsonAssert.java
+++ b/sonar-testing-harness/src/main/java/org/sonar/test/JsonAssert.java
@@ -123,7 +123,7 @@ public class JsonAssert {
}
private static String pretty(String json) {
- JsonElement gson = new JsonParser().parse(json);
+ JsonElement gson = JsonParser.parseString(json);
return new GsonBuilder().setPrettyPrinting().serializeNulls().create().toJson(gson);
}
}