DBHandler: add @Nullable / @NonNull annotations

This commit is contained in:
Thomas Kuehne
2026-06-01 03:43:08 +00:00
parent 7a986ee5e7
commit bd829ce33b
2 changed files with 10 additions and 5 deletions
@@ -18,6 +18,8 @@ package nodomain.freeyourgadget.gadgetbridge;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -65,12 +67,14 @@ public class LockHandler implements DBHandler {
lock.unlock(); lock.unlock();
} }
@NonNull
@Override @Override
public DaoSession getDaoSession() { public DaoSession getDaoSession() {
ensureNotClosed(); ensureNotClosed();
return session; return session;
} }
@NonNull
@Override @Override
public SQLiteDatabase getDatabase() { public SQLiteDatabase getDatabase() {
ensureNotClosed(); ensureNotClosed();
@@ -1,5 +1,5 @@
/* Copyright (C) 2015-2024 Andreas Shimokawa, Carsten Pfeiffer, Daniele /* Copyright (C) 2015-2026 Andreas Shimokawa, Carsten Pfeiffer, Daniele
Gobbetti, JohnnySun Gobbetti, JohnnySun, Thomas Kuehne
This file is part of Gadgetbridge. This file is part of Gadgetbridge.
@@ -19,16 +19,17 @@ package nodomain.freeyourgadget.gadgetbridge.database;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession; import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
/** /**
* Provides low-level access to the database. * Provides low-level access to the database.
*/ */
public interface DBHandler extends AutoCloseable { public interface DBHandler extends AutoCloseable {
@Override @NonNull
void close() throws Exception;
SQLiteDatabase getDatabase(); SQLiteDatabase getDatabase();
@NonNull
DaoSession getDaoSession(); DaoSession getDaoSession();
} }