mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 09:22:23 +00:00
Code analysis - address @NotNull/@Nullable issues.
This commit is contained in:
@@ -145,7 +145,7 @@ public class Address implements Parcelable, Comparable<Address> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public @NonNull String toString() {
|
||||
return address;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.database.Cursor;
|
||||
import android.database.DataSetObserver;
|
||||
import android.database.MatrixCursor;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.util.Collection;
|
||||
@@ -58,9 +59,8 @@ public class CursorList<T> implements List<T>, Closeable {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Iterator<T> iterator() {
|
||||
public @NonNull Iterator<T> iterator() {
|
||||
return new Iterator<T>() {
|
||||
int index = 0;
|
||||
|
||||
@@ -77,9 +77,8 @@ public class CursorList<T> implements List<T>, Closeable {
|
||||
};
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
public @NonNull Object[] toArray() {
|
||||
Object[] out = new Object[size()];
|
||||
for (int i = 0; i < cursor.getCount(); i++) {
|
||||
cursor.moveToPosition(i);
|
||||
@@ -145,19 +144,17 @@ public class CursorList<T> implements List<T>, Closeable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<T> listIterator() {
|
||||
public @NonNull ListIterator<T> listIterator() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ListIterator<T> listIterator(int i) {
|
||||
public @NonNull ListIterator<T> listIterator(int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public List<T> subList(int i, int i1) {
|
||||
public @NonNull List<T> subList(int i, int i1) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -176,9 +173,8 @@ public class CursorList<T> implements List<T>, Closeable {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public T[] toArray(@NonNull Object[] objects) {
|
||||
public @NonNull T[] toArray(@Nullable Object[] objects) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final void onViewRecycled(ViewHolder holder) {
|
||||
public final void onViewRecycled(@NonNull ViewHolder holder) {
|
||||
if (!(holder instanceof HeaderFooterViewHolder)) {
|
||||
onItemViewRecycled((VH)holder);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
|
||||
public void onItemViewRecycled(VH holder) {}
|
||||
|
||||
@Override
|
||||
public final ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
public @NonNull final ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
switch (viewType) {
|
||||
case HEADER_TYPE: return new HeaderFooterViewHolder(header);
|
||||
case FOOTER_TYPE: return new HeaderFooterViewHolder(footer);
|
||||
@@ -151,7 +151,7 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
|
||||
public final void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||
if (!isHeaderPosition(position) && !isFooterPosition(position)) {
|
||||
if (isFastAccessPosition(position)) onBindFastAccessItemViewHolder((VH)viewHolder, position);
|
||||
else onBindItemViewHolder((VH)viewHolder, getCursorAtPositionOrThrow(position));
|
||||
|
||||
@@ -210,7 +210,7 @@ public class IdentityDatabase extends Database {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public @NonNull String toString() {
|
||||
return "{address: " + address + ", identityKey: " + identitykey + ", verifiedStatus: " + verifiedStatus + ", firstUse: " + firstUse + "}";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user