diff --git a/moshi/src/main/java/com/squareup/moshi/ClassJsonAdapter.java b/moshi/src/main/java/com/squareup/moshi/ClassJsonAdapter.java
index 472731d..510e30d 100644
--- a/moshi/src/main/java/com/squareup/moshi/ClassJsonAdapter.java
+++ b/moshi/src/main/java/com/squareup/moshi/ClassJsonAdapter.java
@@ -27,9 +27,19 @@ import java.util.Set;
import java.util.TreeMap;
/**
- * Emits a regular class as a JSON object by mapping Java fields to JSON object properties. Fields
- * of classes in {@code java.*}, {@code javax.*} and {@code android.*} are omitted from both
- * serialization and deserialization unless they are either public or protected.
+ * Emits a regular class as a JSON object by mapping Java fields to JSON object properties.
+ *
+ *
Platform Types
+ * Fields from platform classes are omitted from both serialization and deserialization unless
+ * they are either public or protected. This includes the following packages and their subpackages:
+ *
+ *
+ * - android.*
+ *
- java.*
+ *
- javax.*
+ *
- kotlin.*
+ *
- scala.*
+ *
*/
final class ClassJsonAdapter extends JsonAdapter {
public static final JsonAdapter.Factory FACTORY = new JsonAdapter.Factory() {
@@ -101,9 +111,12 @@ final class ClassJsonAdapter extends JsonAdapter {
* types because they're unspecified and likely to be different on Java vs. Android.
*/
private boolean isPlatformType(Class> rawType) {
- return rawType.getName().startsWith("java.")
- || rawType.getName().startsWith("javax.")
- || rawType.getName().startsWith("android.");
+ String name = rawType.getName();
+ return name.startsWith("android.")
+ || name.startsWith("java.")
+ || name.startsWith("javax.")
+ || name.startsWith("kotlin.")
+ || name.startsWith("scala.");
}
/** Returns true if fields with {@code modifiers} are included in the emitted JSON. */