From 9420b6493c11a287155f28a3e0dbe31addd34a00 Mon Sep 17 00:00:00 2001 From: Eric Cochran Date: Wed, 1 Feb 2017 18:27:58 -0800 Subject: [PATCH] Fix isPlatformType createFieldBindings should not take the allowed platform types into account. --- .../src/main/java/com/squareup/moshi/ClassJsonAdapter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/moshi/src/main/java/com/squareup/moshi/ClassJsonAdapter.java b/moshi/src/main/java/com/squareup/moshi/ClassJsonAdapter.java index 34409d9..377efa9 100644 --- a/moshi/src/main/java/com/squareup/moshi/ClassJsonAdapter.java +++ b/moshi/src/main/java/com/squareup/moshi/ClassJsonAdapter.java @@ -46,7 +46,7 @@ final class ClassJsonAdapter extends JsonAdapter { Type type, Set annotations, Moshi moshi) { Class rawType = Types.getRawType(type); if (rawType.isInterface() || rawType.isEnum()) return null; - if (isPlatformType(rawType)) { + if (isPlatformType(rawType) && !Types.isAllowedPlatformType(rawType)) { throw new IllegalArgumentException("Platform " + type + " annotated " @@ -111,11 +111,11 @@ final class ClassJsonAdapter extends JsonAdapter { */ private boolean isPlatformType(Class rawType) { String name = rawType.getName(); - return (name.startsWith("android.") + return name.startsWith("android.") || name.startsWith("java.") || name.startsWith("javax.") || name.startsWith("kotlin.") - || name.startsWith("scala.")) && !Types.isAllowedPlatformType(rawType); + || name.startsWith("scala."); } /** Returns true if fields with {@code modifiers} are included in the emitted JSON. */