From: Damyan Ivanov Date: Mon, 25 Mar 2019 20:07:34 +0000 (+0200) Subject: fix annotations to match super methods X-Git-Tag: v0.8.1~10 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=c69d34015fc7087af67320b60aa1f6b3aa275b73;p=mobile-ledger.git fix annotations to match super methods --- diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/ObservableList.java b/app/src/main/java/net/ktnx/mobileledger/utils/ObservableList.java index eac02376..3add1bd4 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/ObservableList.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/ObservableList.java @@ -20,6 +20,8 @@ package net.ktnx.mobileledger.utils; import android.os.Build; import android.util.Log; +import org.jetbrains.annotations.NotNull; + import java.util.Collection; import java.util.Comparator; import java.util.Iterator; @@ -203,21 +205,25 @@ public class ObservableList extends Observable implements List { return list.lastIndexOf(o); } } + @NotNull public ListIterator listIterator() { if (!lock.isWriteLockedByCurrentThread()) throw new RuntimeException( "Iterators break encapsulation and ignore locking. Write-lock first"); return list.listIterator(); } + @NotNull public ListIterator listIterator(int index) { if (!lock.isWriteLockedByCurrentThread()) throw new RuntimeException( "Iterators break encapsulation and ignore locking. Write-lock first"); return list.listIterator(index); } + @NotNull public List subList(int fromIndex, int toIndex) { try (LockHolder lh = lockForReading()) { return list.subList(fromIndex, toIndex); } } + @NotNull @RequiresApi(api = Build.VERSION_CODES.N) public Spliterator spliterator() { if (!lock.isWriteLockedByCurrentThread()) throw new RuntimeException(