Merge "Adjust Class<T> parameter bounds in new Bundle APIs" am: 15b7548d05

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2004350

Change-Id: I7beed95d36ba4a83c4e6460dc34d92bdd0873fc8
This commit is contained in:
Bernardo Rufino
2022-03-02 17:32:29 +00:00
committed by Automerger Merge Worker
3 changed files with 6 additions and 5 deletions

View File

@@ -29630,7 +29630,7 @@ package android.os {
method @Deprecated @Nullable public android.os.Parcelable[] getParcelableArray(@Nullable String);
method @Nullable public <T> T[] getParcelableArray(@Nullable String, @NonNull Class<T>);
method @Deprecated @Nullable public <T extends android.os.Parcelable> java.util.ArrayList<T> getParcelableArrayList(@Nullable String);
method @Nullable public <T> java.util.ArrayList<T> getParcelableArrayList(@Nullable String, @NonNull Class<T>);
method @Nullable public <T> java.util.ArrayList<T> getParcelableArrayList(@Nullable String, @NonNull Class<? extends T>);
method @Deprecated @Nullable public java.io.Serializable getSerializable(@Nullable String);
method @Nullable public <T extends java.io.Serializable> T getSerializable(@Nullable String, @NonNull Class<T>);
method public short getShort(String);
@@ -29639,7 +29639,7 @@ package android.os {
method @Nullable public android.util.Size getSize(@Nullable String);
method @Nullable public android.util.SizeF getSizeF(@Nullable String);
method @Deprecated @Nullable public <T extends android.os.Parcelable> android.util.SparseArray<T> getSparseParcelableArray(@Nullable String);
method @Nullable public <T> android.util.SparseArray<T> getSparseParcelableArray(@Nullable String, @NonNull Class<T>);
method @Nullable public <T> android.util.SparseArray<T> getSparseParcelableArray(@Nullable String, @NonNull Class<? extends T>);
method @Nullable public java.util.ArrayList<java.lang.String> getStringArrayList(@Nullable String);
method public boolean hasFileDescriptors();
method public void putAll(android.os.Bundle);

View File

@@ -1453,7 +1453,7 @@ public class BaseBundle {
@SuppressWarnings("unchecked")
@Nullable
<T> ArrayList<T> getArrayList(@Nullable String key, @NonNull Class<T> clazz) {
<T> ArrayList<T> getArrayList(@Nullable String key, @NonNull Class<? extends T> clazz) {
unparcel();
try {
return getValue(key, ArrayList.class, requireNonNull(clazz));

View File

@@ -1059,7 +1059,8 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
@SuppressLint("NullableCollection")
@SuppressWarnings("unchecked")
@Nullable
public <T> ArrayList<T> getParcelableArrayList(@Nullable String key, @NonNull Class<T> clazz) {
public <T> ArrayList<T> getParcelableArrayList(@Nullable String key,
@NonNull Class<? extends T> clazz) {
// The reason for not using <T extends Parcelable> is because the caller could provide a
// super class to restrict the children that doesn't implement Parcelable itself while the
// children do, more details at b/210800751 (same reasoning applies here).
@@ -1107,7 +1108,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
@SuppressWarnings("unchecked")
@Nullable
public <T> SparseArray<T> getSparseParcelableArray(@Nullable String key,
@NonNull Class<T> clazz) {
@NonNull Class<? extends T> clazz) {
// The reason for not using <T extends Parcelable> is because the caller could provide a
// super class to restrict the children that doesn't implement Parcelable itself while the
// children do, more details at b/210800751 (same reasoning applies here).