From f98489f1c025bc31f7a8082ee816a38a6c291705 Mon Sep 17 00:00:00 2001 From: Hao Ke Date: Thu, 14 Oct 2021 15:09:27 +0000 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=9C@throws=20BadParcelableException?= =?UTF-8?q?=E2=80=9D=20to=20the=20JavaDoc=20of=20new=20API=20methods=20tha?= =?UTF-8?q?t=20throw=20the=20exception.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test: atest -d android.os.cts.ParcelTest Bug: b/203004511 Change-Id: I24bf7314e63015d46ab478ec8c44ecf22857bac2 --- core/java/android/os/Parcel.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index 44d51db80f860..9cc00ecb4fdaa 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -2874,9 +2874,11 @@ public final class Parcel { /** * Same as {@link #readList(List, ClassLoader)} but accepts {@code clazz} parameter as - * the type required for each item. If the item to be deserialized is not an instance - * of that class or any of its children class - * a {@link BadParcelableException} will be thrown. + * the type required for each item. + * + * @throws BadParcelableException Throws BadParcelableException if the item to be deserialized + * is not an instance of that class or any of its children classes or there was an error + * trying to instantiate an element. */ public void readList(@NonNull List outVal, @Nullable ClassLoader loader, @NonNull Class clazz) { @@ -3869,8 +3871,11 @@ public final class Parcel { /** * Same as {@link #readParcelable(ClassLoader)} but accepts {@code clazz} parameter as the type - * required for each item. If the item to be deserialized is not an instance of that class or - * any of its children classes a {@link BadParcelableException} will be thrown. + * required for each item. + * + * @throws BadParcelableException Throws BadParcelableException if the item to be deserialized + * is not an instance of that class or any of its children classes or there was an error + * trying to instantiate an element. */ @Nullable public T readParcelable(@Nullable ClassLoader loader, @@ -3936,8 +3941,11 @@ public final class Parcel { /** * Same as {@link #readParcelableCreator(ClassLoader)} but accepts {@code clazz} parameter - * as the required type. If the item to be deserialized is not an instance of that class - * or any of its children classes a {@link BadParcelableException} will be thrown. + * as the required type. + * + * @throws BadParcelableException Throws BadParcelableException if the item to be deserialized + * is not an instance of that class or any of its children class or there there was an error + * trying to read the {@link Parcelable.Creator}. */ @Nullable public Parcelable.Creator readParcelableCreator(