[go: nahoru, domu]

Make several unnecessarily open functions on PagedList final

Test: ./gradlew paging:p-c:test paging:p-run:cC paging:p-rx:cC

Change-Id: Ibdb2f2e917ba7fb8de3e1d1749d76740e803d47c
diff --git a/paging/common/api/3.0.0-alpha01.txt b/paging/common/api/3.0.0-alpha01.txt
index 97740c2..ccfd7a6 100644
--- a/paging/common/api/3.0.0-alpha01.txt
+++ b/paging/common/api/3.0.0-alpha01.txt
@@ -166,30 +166,30 @@
   }
 
   public abstract class PagedList<T> extends java.util.AbstractList<T> {
-    method @Deprecated public void addWeakCallback(java.util.List<? extends T>? previousSnapshot, androidx.paging.PagedList.Callback callback);
-    method public void addWeakCallback(androidx.paging.PagedList.Callback callback);
-    method public void addWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
+    method @Deprecated public final void addWeakCallback(java.util.List<? extends T>? previousSnapshot, androidx.paging.PagedList.Callback callback);
+    method public final void addWeakCallback(androidx.paging.PagedList.Callback callback);
+    method public final void addWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
     method public abstract void detach();
     method public T? get(int index);
     method public final androidx.paging.PagedList.Config getConfig();
     method @Deprecated public final androidx.paging.DataSource<?,T> getDataSource();
     method public abstract Object? getLastKey();
-    method public int getLoadedCount();
-    method public int getPositionOffset();
+    method public final int getLoadedCount();
+    method public final int getPositionOffset();
     method public int getSize();
     method public abstract boolean isDetached();
     method public boolean isImmutable();
-    method public void loadAround(int index);
-    method public void removeWeakCallback(androidx.paging.PagedList.Callback callback);
-    method public void removeWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
+    method public final void loadAround(int index);
+    method public final void removeWeakCallback(androidx.paging.PagedList.Callback callback);
+    method public final void removeWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
     method public void retry();
-    method public java.util.List<T> snapshot();
+    method public final java.util.List<T> snapshot();
     property @Deprecated public final androidx.paging.DataSource<?,T> dataSource;
     property public abstract boolean isDetached;
     property public boolean isImmutable;
     property public abstract Object? lastKey;
-    property public int loadedCount;
-    property public int positionOffset;
+    property public final int loadedCount;
+    property public final int positionOffset;
     property public int size;
   }
 
diff --git a/paging/common/api/current.txt b/paging/common/api/current.txt
index 97740c2..ccfd7a6 100644
--- a/paging/common/api/current.txt
+++ b/paging/common/api/current.txt
@@ -166,30 +166,30 @@
   }
 
   public abstract class PagedList<T> extends java.util.AbstractList<T> {
-    method @Deprecated public void addWeakCallback(java.util.List<? extends T>? previousSnapshot, androidx.paging.PagedList.Callback callback);
-    method public void addWeakCallback(androidx.paging.PagedList.Callback callback);
-    method public void addWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
+    method @Deprecated public final void addWeakCallback(java.util.List<? extends T>? previousSnapshot, androidx.paging.PagedList.Callback callback);
+    method public final void addWeakCallback(androidx.paging.PagedList.Callback callback);
+    method public final void addWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
     method public abstract void detach();
     method public T? get(int index);
     method public final androidx.paging.PagedList.Config getConfig();
     method @Deprecated public final androidx.paging.DataSource<?,T> getDataSource();
     method public abstract Object? getLastKey();
-    method public int getLoadedCount();
-    method public int getPositionOffset();
+    method public final int getLoadedCount();
+    method public final int getPositionOffset();
     method public int getSize();
     method public abstract boolean isDetached();
     method public boolean isImmutable();
-    method public void loadAround(int index);
-    method public void removeWeakCallback(androidx.paging.PagedList.Callback callback);
-    method public void removeWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
+    method public final void loadAround(int index);
+    method public final void removeWeakCallback(androidx.paging.PagedList.Callback callback);
+    method public final void removeWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
     method public void retry();
-    method public java.util.List<T> snapshot();
+    method public final java.util.List<T> snapshot();
     property @Deprecated public final androidx.paging.DataSource<?,T> dataSource;
     property public abstract boolean isDetached;
     property public boolean isImmutable;
     property public abstract Object? lastKey;
-    property public int loadedCount;
-    property public int positionOffset;
+    property public final int loadedCount;
+    property public final int positionOffset;
     property public int size;
   }
 
diff --git a/paging/common/api/restricted_3.0.0-alpha01.txt b/paging/common/api/restricted_3.0.0-alpha01.txt
index d8f2a95..ac4c03c 100644
--- a/paging/common/api/restricted_3.0.0-alpha01.txt
+++ b/paging/common/api/restricted_3.0.0-alpha01.txt
@@ -181,33 +181,33 @@
   }
 
   public abstract class PagedList<T> extends java.util.AbstractList<T> {
-    method @Deprecated public void addWeakCallback(java.util.List<? extends T>? previousSnapshot, androidx.paging.PagedList.Callback callback);
-    method public void addWeakCallback(androidx.paging.PagedList.Callback callback);
-    method public void addWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
+    method @Deprecated public final void addWeakCallback(java.util.List<? extends T>? previousSnapshot, androidx.paging.PagedList.Callback callback);
+    method public final void addWeakCallback(androidx.paging.PagedList.Callback callback);
+    method public final void addWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
     method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static final suspend <K, T> Object create(androidx.paging.PagedSource<K,T> p, kotlinx.coroutines.CoroutineScope pagedSource, kotlinx.coroutines.CoroutineDispatcher coroutineScope, kotlinx.coroutines.CoroutineDispatcher notifyDispatcher, kotlinx.coroutines.CoroutineDispatcher fetchDispatcher, androidx.paging.PagedList.BoundaryCallback<T>? initialFetchDispatcher, androidx.paging.PagedList.Config boundaryCallback, K? config, kotlin.coroutines.Continuation<? super androidx.paging.PagedList<T>> key);
     method public abstract void detach();
     method public T? get(int index);
     method public final androidx.paging.PagedList.Config getConfig();
     method @Deprecated public final androidx.paging.DataSource<?,T> getDataSource();
     method public abstract Object? getLastKey();
-    method public int getLoadedCount();
+    method public final int getLoadedCount();
     method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final androidx.paging.NullPaddedList<T> getNullPaddedList();
-    method public int getPositionOffset();
+    method public final int getPositionOffset();
     method public int getSize();
     method public abstract boolean isDetached();
     method public boolean isImmutable();
-    method public void loadAround(int index);
-    method public void removeWeakCallback(androidx.paging.PagedList.Callback callback);
-    method public void removeWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
+    method public final void loadAround(int index);
+    method public final void removeWeakCallback(androidx.paging.PagedList.Callback callback);
+    method public final void removeWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
     method public void retry();
     method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setInitialLoadState(androidx.paging.LoadType loadType, androidx.paging.LoadState loadState);
-    method public java.util.List<T> snapshot();
+    method public final java.util.List<T> snapshot();
     property @Deprecated public final androidx.paging.DataSource<?,T> dataSource;
     property public abstract boolean isDetached;
     property public boolean isImmutable;
     property public abstract Object? lastKey;
-    property public int loadedCount;
-    property public int positionOffset;
+    property public final int loadedCount;
+    property public final int positionOffset;
     property public int size;
   }
 
diff --git a/paging/common/api/restricted_current.txt b/paging/common/api/restricted_current.txt
index d8f2a95..ac4c03c 100644
--- a/paging/common/api/restricted_current.txt
+++ b/paging/common/api/restricted_current.txt
@@ -181,33 +181,33 @@
   }
 
   public abstract class PagedList<T> extends java.util.AbstractList<T> {
-    method @Deprecated public void addWeakCallback(java.util.List<? extends T>? previousSnapshot, androidx.paging.PagedList.Callback callback);
-    method public void addWeakCallback(androidx.paging.PagedList.Callback callback);
-    method public void addWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
+    method @Deprecated public final void addWeakCallback(java.util.List<? extends T>? previousSnapshot, androidx.paging.PagedList.Callback callback);
+    method public final void addWeakCallback(androidx.paging.PagedList.Callback callback);
+    method public final void addWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
     method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public static final suspend <K, T> Object create(androidx.paging.PagedSource<K,T> p, kotlinx.coroutines.CoroutineScope pagedSource, kotlinx.coroutines.CoroutineDispatcher coroutineScope, kotlinx.coroutines.CoroutineDispatcher notifyDispatcher, kotlinx.coroutines.CoroutineDispatcher fetchDispatcher, androidx.paging.PagedList.BoundaryCallback<T>? initialFetchDispatcher, androidx.paging.PagedList.Config boundaryCallback, K? config, kotlin.coroutines.Continuation<? super androidx.paging.PagedList<T>> key);
     method public abstract void detach();
     method public T? get(int index);
     method public final androidx.paging.PagedList.Config getConfig();
     method @Deprecated public final androidx.paging.DataSource<?,T> getDataSource();
     method public abstract Object? getLastKey();
-    method public int getLoadedCount();
+    method public final int getLoadedCount();
     method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public final androidx.paging.NullPaddedList<T> getNullPaddedList();
-    method public int getPositionOffset();
+    method public final int getPositionOffset();
     method public int getSize();
     method public abstract boolean isDetached();
     method public boolean isImmutable();
-    method public void loadAround(int index);
-    method public void removeWeakCallback(androidx.paging.PagedList.Callback callback);
-    method public void removeWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
+    method public final void loadAround(int index);
+    method public final void removeWeakCallback(androidx.paging.PagedList.Callback callback);
+    method public final void removeWeakLoadStateListener(kotlin.jvm.functions.Function2<? super androidx.paging.LoadType,? super androidx.paging.LoadState,kotlin.Unit> listener);
     method public void retry();
     method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setInitialLoadState(androidx.paging.LoadType loadType, androidx.paging.LoadState loadState);
-    method public java.util.List<T> snapshot();
+    method public final java.util.List<T> snapshot();
     property @Deprecated public final androidx.paging.DataSource<?,T> dataSource;
     property public abstract boolean isDetached;
     property public boolean isImmutable;
     property public abstract Object? lastKey;
-    property public int loadedCount;
-    property public int positionOffset;
+    property public final int loadedCount;
+    property public final int positionOffset;
     property public int size;
   }
 
diff --git a/paging/common/src/main/kotlin/androidx/paging/PagedList.kt b/paging/common/src/main/kotlin/androidx/paging/PagedList.kt
index 654a368..f161ae5 100644
--- a/paging/common/src/main/kotlin/androidx/paging/PagedList.kt
+++ b/paging/common/src/main/kotlin/androidx/paging/PagedList.kt
@@ -1023,7 +1023,7 @@
      *
      * @see size
      */
-    open val loadedCount
+    val loadedCount
         get() = storage.storageCount
 
     /**
@@ -1048,7 +1048,7 @@
      * If the [PagedSource] has a [PagedSource.KeyProvider.ItemKey] or
      * [PagedSource.KeyProvider.PageKey], it doesn't use positions, returns 0.
      */
-    open val positionOffset: Int
+    val positionOffset: Int
         get() = storage.positionOffset
 
     /**
@@ -1103,7 +1103,7 @@
      *
      * @param index Index at which to load.
      */
-    open fun loadAround(index: Int) {
+    fun loadAround(index: Int) {
         if (index < 0 || index >= size) {
             throw IndexOutOfBoundsException("Index: $index, Size: $size")
         }
@@ -1118,7 +1118,7 @@
      *
      * @return Immutable snapshot of [PagedList] data.
      */
-    open fun snapshot(): List<T> = when {
+    fun snapshot(): List<T> = when {
         isImmutable -> this
         else -> SnapshotPagedList(this)
     }
@@ -1130,7 +1130,7 @@
      *
      * @see removeWeakLoadStateListener
      */
-    open fun addWeakLoadStateListener(listener: LoadStateListener) {
+    fun addWeakLoadStateListener(listener: LoadStateListener) {
         // Clean up any empty weak refs.
         loadStateListeners.removeAll { it.get() == null }
 
@@ -1146,7 +1146,7 @@
      *
      * @see addWeakLoadStateListener
      */
-    open fun removeWeakLoadStateListener(listener: LoadStateListener) {
+    fun removeWeakLoadStateListener(listener: LoadStateListener) {
         loadStateListeners.removeAll { it.get() == null || it.get() === listener }
     }
 
@@ -1174,7 +1174,7 @@
     @Deprecated("Dispatching a diff since snapshot created is behavior that can be instead " +
             "tracked by attaching a Callback to the PagedList that is mutating, and tracking " +
             "changes since calling PagedList.snapshot().")
-    open fun addWeakCallback(previousSnapshot: List<T>?, callback: Callback) {
+    fun addWeakCallback(previousSnapshot: List<T>?, callback: Callback) {
         if (previousSnapshot != null && previousSnapshot !== this) {
             dispatchNaiveUpdatesSinceSnapshot(size, previousSnapshot.size, callback)
         }
@@ -1193,7 +1193,7 @@
      *
      * @see removeWeakCallback
      */
-    open fun addWeakCallback(callback: Callback) {
+    fun addWeakCallback(callback: Callback) {
         // first, clean up any empty weak refs
         callbacks.removeAll { it.get() == null }
 
@@ -1208,7 +1208,7 @@
      *
      * @see addWeakCallback
      */
-    open fun removeWeakCallback(callback: Callback) {
+    fun removeWeakCallback(callback: Callback) {
         callbacks.removeAll { it.get() == null || it.get() === callback }
     }