From 232519b4881710ce621ab49c9d69e79bed20b511 Mon Sep 17 00:00:00 2001 From: Sab44 <64696149+Sab44@users.noreply.github.com> Date: Tue, 15 Feb 2022 16:13:53 +0100 Subject: [PATCH] annotate items variable with nullable to allow null-safety kotlin compiler checks (#107) Co-authored-by: Sab44 <> --- .../adapterdelegates4/AbsDelegationAdapter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/hannesdorfmann/adapterdelegates4/AbsDelegationAdapter.java b/library/src/main/java/com/hannesdorfmann/adapterdelegates4/AbsDelegationAdapter.java index e08fe7f..43b47e5 100644 --- a/library/src/main/java/com/hannesdorfmann/adapterdelegates4/AbsDelegationAdapter.java +++ b/library/src/main/java/com/hannesdorfmann/adapterdelegates4/AbsDelegationAdapter.java @@ -21,6 +21,7 @@ import java.util.List; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; /** @@ -58,7 +59,7 @@ public abstract class AbsDelegationAdapter extends RecyclerView.Adapter { protected AdapterDelegatesManager delegatesManager; - protected T items; + @Nullable protected T items; public AbsDelegationAdapter() { this(new AdapterDelegatesManager()); @@ -128,6 +129,7 @@ public void onViewDetachedFromWindow(@NonNull RecyclerView.ViewHolder holder) { * * @return The items / data source */ + @Nullable public T getItems() { return items; } @@ -137,7 +139,7 @@ public T getItems() { * * @param items The items / data source */ - public void setItems(T items) { + public void setItems(@Nullable T items) { this.items = items; } }