From 0e53a371abf4f7a0e08426970f3029ef0e45d531 Mon Sep 17 00:00:00 2001 From: Mateus Azis Date: Fri, 10 Mar 2023 00:18:34 +0000 Subject: [PATCH] Parcelable: mention that the CREATOR field must be public. Using a package-private or private field will result in a runtime error, but this requirement is not mentioned anywhere. Change-Id: I0e79a4865ba2681f399822d28ccc43744abcd1b3 Test: N/A --- core/java/android/os/Parcelable.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/java/android/os/Parcelable.java b/core/java/android/os/Parcelable.java index a2b0486c1df52..f2b60a4e3988b 100644 --- a/core/java/android/os/Parcelable.java +++ b/core/java/android/os/Parcelable.java @@ -16,8 +16,8 @@ package android.os; -import android.annotation.NonNull; import android.annotation.IntDef; +import android.annotation.NonNull; import android.annotation.SystemApi; import java.lang.annotation.Retention; @@ -26,8 +26,9 @@ import java.lang.annotation.RetentionPolicy; /** * Interface for classes whose instances can be written to * and restored from a {@link Parcel}. Classes implementing the Parcelable - * interface must also have a non-null static field called CREATOR - * of a type that implements the {@link Parcelable.Creator} interface. + * interface must also have a non-null public static field called + * CREATOR of a type that implements the {@link Parcelable.Creator} + * interface. * *

A typical implementation of Parcelable is:

*