diff --git a/gson/src/main/java/com/google/gson/reflect/TypeToken.java b/gson/src/main/java/com/google/gson/reflect/TypeToken.java index 3cda0159..886cc158 100644 --- a/gson/src/main/java/com/google/gson/reflect/TypeToken.java +++ b/gson/src/main/java/com/google/gson/reflect/TypeToken.java @@ -16,6 +16,7 @@ package com.google.gson.reflect; +import com.google.gson.internal.Preconditions; import com.google.gson.internal.Types; import java.lang.reflect.GenericArrayType; @@ -74,8 +75,7 @@ public class TypeToken { */ @SuppressWarnings("unchecked") TypeToken(Type type) { - checkNotNull(type); - this.type = Types.canonicalize(type); + this.type = Types.canonicalize(Preconditions.checkNotNull(type)); this.rawType = (Class) Types.getRawType(this.type); this.hashCode = this.type.hashCode(); } @@ -310,14 +310,4 @@ public class TypeToken { public static TypeToken get(Class type) { return new TypeToken(type); } - - static void checkNotNull(Object obj) { - checkArgument(obj != null); - } - - static void checkArgument(boolean condition) { - if (!condition) { - throw new IllegalArgumentException("condition failed: " + condition); - } - } }