From 263a91894be56bd1c0b02e7bddc5e68faeabee38 Mon Sep 17 00:00:00 2001 From: Sachin Patil Date: Sun, 24 Sep 2023 16:33:37 -0500 Subject: [PATCH] #2436 - formatting and minor changes as per review. --- gson/src/main/java/com/google/gson/GsonBuilder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gson/src/main/java/com/google/gson/GsonBuilder.java b/gson/src/main/java/com/google/gson/GsonBuilder.java index 40fcc40655..21ff96df61 100644 --- a/gson/src/main/java/com/google/gson/GsonBuilder.java +++ b/gson/src/main/java/com/google/gson/GsonBuilder.java @@ -675,7 +675,7 @@ public GsonBuilder registerTypeAdapter(Type type, Object typeAdapter) { || typeAdapter instanceof InstanceCreator || typeAdapter instanceof TypeAdapter); - if(isTypeObjectOrJsonElement(type)){ + if (isTypeObjectOrJsonElement(type)){ throw new IllegalArgumentException("Cannot override built-in adapter for " + type); } @@ -695,9 +695,9 @@ public GsonBuilder registerTypeAdapter(Type type, Object typeAdapter) { } private boolean isTypeObjectOrJsonElement(Type type) { - return (!(type instanceof ParameterizedType) && + return type instanceof Class && (type == Object.class - || (type instanceof Class && JsonElement.class.isAssignableFrom((Class) type)))); + || JsonElement.class.isAssignableFrom((Class) type)); } /**