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
This commit is contained in:
Mateus Azis
2023-03-10 00:18:34 +00:00
parent f74b6baf67
commit 0e53a371ab

View File

@@ -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 <code>CREATOR</code>
* of a type that implements the {@link Parcelable.Creator} interface.
* interface must also have a non-null public static field called
* <code>CREATOR</code> of a type that implements the {@link Parcelable.Creator}
* interface.
*
* <p>A typical implementation of Parcelable is:</p>
*