diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java index 71d61d7276..a2825f000a 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelperProvider.java @@ -1,8 +1,9 @@ package info.nightscout.androidaps.db; +import androidx.annotation.NonNull; + import com.j256.ormlite.dao.CloseableIterator; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.sql.SQLException; @@ -20,31 +21,31 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface { @Inject DatabaseHelperProvider() { } - @Override public void createOrUpdate(@NotNull CareportalEvent careportalEvent) { + @Override public void createOrUpdate(@NonNull CareportalEvent careportalEvent) { MainApp.getDbHelper().createOrUpdate(careportalEvent); } - @Override public void createOrUpdate(@NotNull DanaRHistoryRecord record) { + @Override public void createOrUpdate(@NonNull DanaRHistoryRecord record) { MainApp.getDbHelper().createOrUpdate(record); } - @Override public void createOrUpdate(@NotNull OmnipodHistoryRecord record) { + @Override public void createOrUpdate(@NonNull OmnipodHistoryRecord record) { MainApp.getDbHelper().createOrUpdate(record); } - @NotNull @Override public List getDanaRHistoryRecordsByType(byte type) { + @NonNull @Override public List getDanaRHistoryRecordsByType(byte type) { return MainApp.getDbHelper().getDanaRHistoryRecordsByType(type); } - @NotNull @Override public List getTDDs() { + @NonNull @Override public List getTDDs() { return MainApp.getDbHelper().getTDDs(); } - @Override public long size(@NotNull String table) { + @Override public long size(@NonNull String table) { return MainApp.getDbHelper().size(table); } - @Override public void create(@NotNull DbRequest record) { + @Override public void create(@NonNull DbRequest record) { try { MainApp.getDbHelper().create(record); } catch (SQLException e) { @@ -56,15 +57,15 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface { MainApp.getDbHelper().deleteAllDbRequests(); } - @Override public int deleteDbRequest(@NotNull String id) { + @Override public int deleteDbRequest(@NonNull String id) { return MainApp.getDbHelper().deleteDbRequest(id); } - @Override public void deleteDbRequestbyMongoId(@NotNull String action, @NotNull String _id) { + @Override public void deleteDbRequestbyMongoId(@NonNull String action, @NonNull String _id) { MainApp.getDbHelper().deleteDbRequestbyMongoId(action, _id); } - @NotNull @Override public CloseableIterator getDbRequestInterator() { + @NonNull @Override public CloseableIterator getDbRequestInterator() { return MainApp.getDbHelper().getDbRequestInterator(); } @@ -72,19 +73,19 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface { return MainApp.getDbHelper().roundDateToSec(date); } - @Override public void createOrUpdateTDD(@NotNull TDD record) { + @Override public void createOrUpdateTDD(@NonNull TDD record) { MainApp.getDbHelper().createOrUpdateTDD(record); } - @Override public void createOrUpdate(@NotNull TemporaryBasal tempBasal) { + @Override public void createOrUpdate(@NonNull TemporaryBasal tempBasal) { MainApp.getDbHelper().createOrUpdate(tempBasal); } - @NotNull @Override public TemporaryBasal findTempBasalByPumpId(long id) { + @NonNull @Override public TemporaryBasal findTempBasalByPumpId(long id) { return MainApp.getDbHelper().findTempBasalByPumpId(id); } - @NotNull @Override public List getTemporaryBasalsDataFromTime(long mills, boolean ascending) { + @NonNull @Override public List getTemporaryBasalsDataFromTime(long mills, boolean ascending) { return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(mills, ascending); } @@ -92,7 +93,7 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface { return MainApp.getDbHelper().getCareportalEventFromTimestamp(timestamp); } - @NotNull @Override public List getAllOmnipodHistoryRecordsFromTimestamp(long timestamp, boolean ascending) { + @NonNull @Override public List getAllOmnipodHistoryRecordsFromTimestamp(long timestamp, boolean ascending) { return MainApp.getDbHelper().getAllOmnipodHistoryRecordsFromTimeStamp(timestamp, ascending); } @@ -100,27 +101,27 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface { return MainApp.getDbHelper().findOmnipodHistoryRecordByPumpId(pumpId); } - @NotNull @Override public List getTDDsForLastXDays(int days) { + @NonNull @Override public List getTDDsForLastXDays(int days) { return MainApp.getDbHelper().getTDDsForLastXDays(days); } - @NotNull @Override public List getProfileSwitchData(long from, boolean ascending) { + @NonNull @Override public List getProfileSwitchData(long from, boolean ascending) { return MainApp.getDbHelper().getProfileSwitchData(from, ascending); } - @Override public void createOrUpdate(@NotNull InsightBolusID record) { + @Override public void createOrUpdate(@NonNull InsightBolusID record) { MainApp.getDbHelper().createOrUpdate(record); } - @Override public void createOrUpdate(@NotNull InsightPumpID record) { + @Override public void createOrUpdate(@NonNull InsightPumpID record) { MainApp.getDbHelper().createOrUpdate(record); } - @Override public void createOrUpdate(@NotNull InsightHistoryOffset record) { + @Override public void createOrUpdate(@NonNull InsightHistoryOffset record) { MainApp.getDbHelper().createOrUpdate(record); } - @Override public void delete(@NotNull ExtendedBolus extendedBolus) { + @Override public void delete(@NonNull ExtendedBolus extendedBolus) { MainApp.getDbHelper().delete(extendedBolus); } @@ -128,15 +129,15 @@ public class DatabaseHelperProvider implements DatabaseHelperInterface { return MainApp.getDbHelper().getExtendedBolusByPumpId(pumpId); } - @Nullable @Override public InsightBolusID getInsightBolusID(@NotNull String pumpSerial, int bolusID, long timestamp) { + @Nullable @Override public InsightBolusID getInsightBolusID(@NonNull String pumpSerial, int bolusID, long timestamp) { return MainApp.getDbHelper().getInsightBolusID(pumpSerial, bolusID, timestamp); } - @Nullable @Override public InsightHistoryOffset getInsightHistoryOffset(@NotNull String pumpSerial) { + @Nullable @Override public InsightHistoryOffset getInsightHistoryOffset(@NonNull String pumpSerial) { return MainApp.getDbHelper().getInsightHistoryOffset(pumpSerial); } - @Nullable @Override public InsightPumpID getPumpStoppedEvent(@NotNull String pumpSerial, long before) { + @Nullable @Override public InsightPumpID getPumpStoppedEvent(@NonNull String pumpSerial, long before) { return MainApp.getDbHelper().getPumpStoppedEvent(pumpSerial, before); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/Food.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/Food.java index e30987b251..61c5f0b16f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/Food.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/Food.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.general.food; +import androidx.annotation.NonNull; + import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; @@ -123,7 +125,7 @@ public class Food { gi = other.gi; } - @Override + @Override @NonNull public String toString() { StringBuilder sb = new StringBuilder(); sb.append("_id=" + _id + ";"); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java index de1b919ed1..1c15a2cd16 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java @@ -13,7 +13,7 @@ import android.text.Spanned; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreference; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -214,7 +214,7 @@ public class NSClientPlugin extends PluginBase { } @Override - public void preprocessPreferences(@NotNull PreferenceFragmentCompat preferenceFragment) { + public void preprocessPreferences(@NonNull PreferenceFragmentCompat preferenceFragment) { super.preprocessPreferences(preferenceFragment); if (config.getNSCLIENT()) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientWorker.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientWorker.java index b36557c534..a5d4fcd597 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientWorker.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientWorker.java @@ -7,7 +7,7 @@ import androidx.annotation.NonNull; import androidx.work.Worker; import androidx.work.WorkerParameters; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import javax.inject.Inject; @@ -28,7 +28,7 @@ public class NSClientWorker extends Worker { @Inject NSClientPlugin nsClientPlugin; @Inject BundleStore bundleStore; - @NotNull + @NonNull @Override public Result doWork() { Bundle bundle = bundleStore.pickup(getInputData().getLong(DataReceiver.STORE_KEY, -1)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java index 55e61bb5c6..74e7b2564e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.sensitivity; import androidx.annotation.NonNull; import androidx.collection.LongSparseArray; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import org.json.JSONException; import org.json.JSONObject; @@ -186,11 +186,11 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin { return output; } - @NotNull @Override public SensitivityType getId() { + @NonNull @Override public SensitivityType getId() { return SensitivityType.SENSITIVITY_AAPS; } - @NotNull @Override public JSONObject configuration() { + @NonNull @Override public JSONObject configuration() { JSONObject c = new JSONObject(); try { c.put(getResourceHelper().gs(R.string.key_absorption_maxtime), getSp().getDouble(R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)); @@ -203,7 +203,7 @@ public class SensitivityAAPSPlugin extends AbstractSensitivityPlugin { return c; } - @Override public void applyConfiguration(@NotNull JSONObject configuration) { + @Override public void applyConfiguration(@NonNull JSONObject configuration) { try { if (configuration.has(getResourceHelper().gs(R.string.key_absorption_maxtime))) getSp().putDouble(R.string.key_absorption_maxtime, configuration.getDouble(getResourceHelper().gs(R.string.key_absorption_maxtime))); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java index fbc1baa5e1..e16e3d4ed2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.sensitivity; import androidx.collection.LongSparseArray; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import org.json.JSONException; import org.json.JSONObject; @@ -68,7 +68,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin { this.dateUtil = dateUtil; } - @NotNull @Override + @NonNull @Override public AutosensResult detectSensitivity(IobCobCalculatorInterface iobCobCalculatorPlugin, long fromTime, long toTime) { // todo this method is called from the IobCobCalculatorPlugin, which leads to a circular // dependency, this should be avoided @@ -252,7 +252,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin { return output; } - @NotNull @Override public JSONObject configuration() { + @NonNull @Override public JSONObject configuration() { JSONObject c = new JSONObject(); try { c.put(getResourceHelper().gs(R.string.key_openapsama_min_5m_carbimpact), getSp().getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact)); @@ -265,7 +265,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin { return c; } - @Override public void applyConfiguration(@NotNull JSONObject configuration) { + @Override public void applyConfiguration(@NonNull JSONObject configuration) { try { if (configuration.has(getResourceHelper().gs(R.string.key_openapsama_min_5m_carbimpact))) getSp().putDouble(R.string.key_openapsama_min_5m_carbimpact, configuration.getDouble(getResourceHelper().gs(R.string.key_openapsama_min_5m_carbimpact))); @@ -280,7 +280,7 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin { } } - @NotNull @Override public SensitivityType getId() { + @NonNull @Override public SensitivityType getId() { return SensitivityType.SENSITIVITY_OREF1; } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java index 3cc34908a5..548f264fd9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.sensitivity; import androidx.collection.LongSparseArray; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import org.json.JSONException; import org.json.JSONObject; @@ -206,11 +206,11 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin return output; } - @NotNull @Override public SensitivityType getId() { + @NonNull @Override public SensitivityType getId() { return SensitivityType.SENSITIVITY_WEIGHTED; } - @NotNull @Override public JSONObject configuration() { + @NonNull @Override public JSONObject configuration() { JSONObject c = new JSONObject(); try { c.put(getResourceHelper().gs(R.string.key_absorption_maxtime), getSp().getDouble(R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)); @@ -223,7 +223,7 @@ public class SensitivityWeightedAveragePlugin extends AbstractSensitivityPlugin return c; } - @Override public void applyConfiguration(@NotNull JSONObject configuration) { + @Override public void applyConfiguration(@NonNull JSONObject configuration) { try { if (configuration.has(getResourceHelper().gs(R.string.key_absorption_maxtime))) getSp().putDouble(R.string.key_absorption_maxtime, configuration.getDouble(getResourceHelper().gs(R.string.key_absorption_maxtime))); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java index 41e3673493..b9df26c318 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentsPlugin.java @@ -8,7 +8,7 @@ import androidx.annotation.Nullable; import com.google.firebase.analytics.FirebaseAnalytics; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.List; @@ -765,7 +765,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface } @Override - public void doProfileSwitch(@NotNull final ProfileStore profileStore, @NotNull final String profileName, final int duration, final int percentage, final int timeShift, final long date) { + public void doProfileSwitch(@NonNull final ProfileStore profileStore, @NonNull final String profileName, final int duration, final int percentage, final int timeShift, final long date) { ProfileSwitch profileSwitch = profileFunction.prepareProfileSwitch(profileStore, profileName, duration, percentage, timeShift, date); addToHistoryProfileSwitch(profileSwitch); if (percentage == 90 && duration == 10) diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java index cdf9e416d8..25512f0126 100644 --- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java +++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java @@ -1255,9 +1255,9 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr } @NonNull @Override - public JSONObject getJSONStatus(@NotNull Profile profile, @NotNull String profileName, @NotNull String version) { + public JSONObject getJSONStatus(@NonNull Profile profile, @NonNull String profileName, @NonNull String version) { if (!pump.initialized) { - return null; + return new JSONObject(); } try { @@ -1302,7 +1302,7 @@ public class ComboPlugin extends PumpPluginBase implements PumpInterface, Constr getAapsLogger().warn(LTag.PUMP, "Failed to gather device status for upload " + e); } - return null; + return new JSONObject(); } @NonNull @Override diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java index 9cdee1c9fd..721bc26cbc 100644 --- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java +++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/BasalProfile.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +import androidx.annotation.NonNull; + import java.util.Arrays; public class BasalProfile { @@ -29,7 +31,7 @@ public class BasalProfile { return Arrays.hashCode(hourlyRates); } - @Override + @NonNull @Override public String toString() { double total = 0d; for(int i = 0; i < 24; i++) { diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java index 9febf0e86a..67a17b6563 100644 --- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java +++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/CommandResult.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import java.util.LinkedList; @@ -46,7 +47,7 @@ public class CommandResult { return this; } - @Override + @Override @NonNull public String toString() { return "CommandResult{" + "success=" + success + diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java index 42a94f78ff..5852fa6e1d 100644 --- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java +++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/BolusCommand.java @@ -2,10 +2,11 @@ package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; import android.os.SystemClock; +import androidx.annotation.NonNull; + import org.monkey.d.ruffy.ruffy.driver.display.MenuAttribute; import org.monkey.d.ruffy.ruffy.driver.display.MenuType; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; @@ -14,8 +15,8 @@ import java.util.Objects; import info.nightscout.androidaps.logging.StacktraceLoggerWrapper; import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter; import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.PumpWarningCodes; -import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.WarningOrErrorCode; import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter; +import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.WarningOrErrorCode; import static info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter.State.DELIVERED; import static info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.BolusProgressReporter.State.DELIVERING; @@ -244,7 +245,7 @@ public class BolusCommand extends BaseCommand { bolusProgressReporter.report(STOPPING, 0, 0); } - @Override + @Override @NonNull public String toString() { return "BolusCommand{" + "bolus=" + bolus + diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java index b92aca13d5..14faf02b2c 100644 --- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java +++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ruffyscripter/commands/CancelTbrCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.commands; +import androidx.annotation.NonNull; + import org.monkey.d.ruffy.ruffy.driver.display.MenuType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,7 +37,7 @@ public class CancelTbrCommand extends BaseCommand { result = setTbrCommand.result; } - @Override + @Override @NonNull public String toString() { return "CancelTbrCommand{}"; } diff --git a/core/src/main/java/info/nightscout/androidaps/data/Profile.java b/core/src/main/java/info/nightscout/androidaps/data/Profile.java index fbc60b5ec1..fd11bc56fd 100644 --- a/core/src/main/java/info/nightscout/androidaps/data/Profile.java +++ b/core/src/main/java/info/nightscout/androidaps/data/Profile.java @@ -2,7 +2,7 @@ package info.nightscout.androidaps.data; import androidx.collection.LongSparseArray; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import org.joda.time.DateTime; import org.json.JSONArray; import org.json.JSONException; @@ -67,7 +67,7 @@ public class Profile { this.injector = injector; } - @NotNull @Override + @NonNull @Override public String toString() { if (json != null) return json.toString(); diff --git a/core/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java b/core/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java index 22768183a3..02020765cc 100644 --- a/core/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java +++ b/core/src/main/java/info/nightscout/androidaps/db/CareportalEvent.java @@ -2,6 +2,8 @@ package info.nightscout.androidaps.db; import android.graphics.Color; +import androidx.annotation.NonNull; + import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; @@ -132,7 +134,7 @@ public class CareportalEvent implements DataPointWithLabelInterface, Interval { return getHoursFromStart() > hours; } - @Override + @Override @NonNull public String toString() { return "CareportalEvent{" + "date= " + date + diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java b/core/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java index 2f847d6228..c3b4342756 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.interfaces; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import java.util.List; @@ -84,7 +84,7 @@ public interface TreatmentsInterface { void addToHistoryProfileSwitch(ProfileSwitch profileSwitch); - void doProfileSwitch(@NotNull final ProfileStore profileStore, @NotNull final String profileName, final int duration, final int percentage, final int timeShift, final long date); + void doProfileSwitch(@NonNull final ProfileStore profileStore, @NonNull final String profileName, final int duration, final int percentage, final int timeShift, final long date); void doProfileSwitch(final int duration, final int percentage, final int timeShift); diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.java b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.java index 51a1b58c18..f791d96f1a 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.java +++ b/core/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator.data; +import androidx.annotation.NonNull; + import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -40,10 +42,10 @@ public class AutosensData implements DataPointWithLabelInterface { } public class CarbsInPast { - long time = 0L; - double carbs = 0d; - public double min5minCarbImpact = 0d; - double remaining = 0d; + long time; + double carbs; + public double min5minCarbImpact; + double remaining; public CarbsInPast(Treatment t, boolean isAAPSOrWeighted) { time = t.date; @@ -68,7 +70,7 @@ public class AutosensData implements DataPointWithLabelInterface { this.remaining = other.remaining; } - @Override + @NonNull @Override public String toString() { return String.format(Locale.ENGLISH, "CarbsInPast: time: %s carbs: %.02f min5minCI: %.02f remaining: %.2f", dateUtil.dateAndTimeString(time), carbs, min5minCarbImpact, remaining); } @@ -103,7 +105,7 @@ public class AutosensData implements DataPointWithLabelInterface { public boolean uam = false; public List extraDeviation = new ArrayList<>(); - @Override + @NonNull @Override public String toString() { return String.format(Locale.ENGLISH, "AutosensData: %s pastSensitivity=%s delta=%.02f avgDelta=%.02f bgi=%.02f deviation=%.02f avgDeviation=%.02f absorbed=%.02f carbsFromBolus=%.02f cob=%.02f autosensRatio=%.02f slopeFromMaxDeviation=%.02f slopeFromMinDeviation=%.02f activeCarbsList=%s", dateUtil.dateAndTimeString(time), pastSensitivity, delta, avgDelta, bgi, deviation, avgDeviation, absorbed, carbsFromBolus, cob, autosensResult.ratio, slopeFromMaxDeviation, slopeFromMinDeviation, activeCarbsList.toString()); @@ -121,7 +123,7 @@ public class AutosensData implements DataPointWithLabelInterface { // remove carbs older than timeframe public void removeOldCarbs(long toTime, boolean isAAPSOrWeighted) { - double maxAbsorptionHours = Constants.DEFAULT_MAX_ABSORPTION_TIME; + double maxAbsorptionHours; if (isAAPSOrWeighted) { maxAbsorptionHours = sp.getDouble(R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME); } else { diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java index b68234baee..6f6cd78374 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/PumpPluginAbstract.java @@ -6,7 +6,6 @@ import android.content.ServiceConnection; import androidx.annotation.NonNull; -import org.jetbrains.annotations.NotNull; import org.json.JSONException; import org.json.JSONObject; @@ -445,7 +444,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements PumpI return pumpType.getManufacturer(); } - @NotNull + @NonNull public PumpType model() { return pumpType; } diff --git a/core/src/main/java/info/nightscout/androidaps/utils/ui/DigitsKeyListenerWithComma.java b/core/src/main/java/info/nightscout/androidaps/utils/ui/DigitsKeyListenerWithComma.java index b4e87aa795..c4bf793ca0 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/ui/DigitsKeyListenerWithComma.java +++ b/core/src/main/java/info/nightscout/androidaps/utils/ui/DigitsKeyListenerWithComma.java @@ -6,6 +6,8 @@ import android.text.Spanned; import android.text.method.NumberKeyListener; import android.view.KeyEvent; +import androidx.annotation.NonNull; + class DigitsKeyListenerWithComma extends NumberKeyListener { /** @@ -30,7 +32,7 @@ class DigitsKeyListenerWithComma extends NumberKeyListener { private static final DigitsKeyListenerWithComma[] sInstance = new DigitsKeyListenerWithComma[4]; - @Override + @Override @NonNull protected char[] getAcceptedChars() { return mAccepted; } @@ -109,7 +111,7 @@ class DigitsKeyListenerWithComma extends NumberKeyListener { Spanned dest, int dstart, int dend) { CharSequence out = super.filter(source, start, end, dest, dstart, dend); - if (mSign == false && mDecimal == false) { + if (!mSign && !mDecimal) { return out; } diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.java index 32070359d4..2b029807b4 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRKorean/DanaRKoreanPlugin.java @@ -194,7 +194,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { // This is called from APS @NonNull @Override - public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, Profile profile, boolean enforceNew) { + public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NonNull Profile profile, boolean enforceNew) { // Recheck pump status if older than 30 min //This should not be needed while using queue because connection should be done before calling this //if (pump.lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis()) { @@ -234,7 +234,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { } if (doLowTemp || doHighTemp) { - Integer percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue(); + int percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue(); // Any basal less than 0.10u/h will be dumped once per hour, not every 4 mins. So if it's less than .10u/h, set a zero temp. if (absoluteRate < 0.10d) percentRate = 0; if (percentRate < 100) percentRate = Round.ceilTo((double) percentRate, 10d).intValue(); @@ -314,7 +314,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { } // Now set new extended, no need to to stop previous (if running) because it's replaced - Double extendedAmount = extendedRateToSet / 2 * durationInHalfHours; + double extendedAmount = extendedRateToSet / 2 * durationInHalfHours; aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: Setting extended: " + extendedAmount + "U halfhours: " + durationInHalfHours); result = setExtendedBolus(extendedAmount, durationInMinutes); if (!result.success) { @@ -365,14 +365,13 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { result.isTempCancel = true; result.comment = resourceHelper.gs(R.string.ok); aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: OK"); - return result; } else { result.success = false; result.comment = resourceHelper.gs(R.string.danar_valuenotsetproperly); result.isTempCancel = true; aapsLogger.error("cancelRealTempBasal: Failed to cancel temp basal"); - return result; } + return result; } @Override diff --git a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java index f27187a510..125fe6f51b 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danaRv2/DanaRv2Plugin.java @@ -220,7 +220,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { // This is called from APS @NonNull @Override - public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, Profile profile, boolean enforceNew) { + public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NonNull Profile profile, boolean enforceNew) { // Recheck pump status if older than 30 min //This should not be needed while using queue because connection should be done before calling this //if (pump.lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis()) { @@ -298,7 +298,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { } @NonNull @Override - public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, Profile profile, boolean enforceNew) { + public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, @NonNull Profile profile, boolean enforceNew) { DanaPump pump = danaPump; PumpEnactResult result = new PumpEnactResult(getInjector()); percent = constraintChecker.applyBasalPercentConstraints(new Constraint<>(percent), profile).value(); @@ -386,14 +386,13 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { result.isTempCancel = true; result.comment = resourceHelper.gs(R.string.ok); aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: OK"); - return result; } else { result.success = false; result.comment = resourceHelper.gs(R.string.danar_valuenotsetproperly); result.isTempCancel = true; aapsLogger.error("cancelRealTempBasal: Failed to cancel temp basal"); - return result; } + return result; } @NonNull @Override diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java index b5c7dd2278..10f6b652b8 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/AbstractDanaRPlugin.java @@ -2,6 +2,7 @@ package info.nightscout.androidaps.danar; import androidx.annotation.NonNull; +import androidx.annotation.NonNull; import org.json.JSONException; import org.json.JSONObject; @@ -134,7 +135,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump // Pump interface @NonNull @Override - public PumpEnactResult setNewBasalProfile(Profile profile) { + public PumpEnactResult setNewBasalProfile(@NonNull Profile profile) { PumpEnactResult result = new PumpEnactResult(getInjector()); if (sExecutionService == null) { @@ -155,7 +156,6 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, getResourceHelper().gs(R.string.failedupdatebasalprofile), Notification.URGENT); rxBus.send(new EventNewNotification(notification)); result.comment = getResourceHelper().gs(R.string.failedupdatebasalprofile); - return result; } else { rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED)); rxBus.send(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE)); @@ -164,12 +164,12 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump result.success = true; result.enacted = true; result.comment = "OK"; - return result; } + return result; } @Override - public boolean isThisProfileSet(Profile profile) { + public boolean isThisProfileSet(@NonNull Profile profile) { if (!isInitialized()) return true; // TODO: not sure what's better. so far TRUE to prevent too many SMS if (danaPump.getPumpProfiles() == null) @@ -217,7 +217,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump } @NonNull @Override - public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, Profile profile, boolean enforceNew) { + public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, @NonNull Profile profile, boolean enforceNew) { DanaPump pump = danaPump; PumpEnactResult result = new PumpEnactResult(getInjector()); percent = constraintChecker.applyBasalPercentConstraints(new Constraint<>(percent), profile).value(); @@ -319,13 +319,12 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump result.success = true; result.comment = getResourceHelper().gs(R.string.ok); getAapsLogger().debug(LTag.PUMP, "cancelExtendedBolus: OK"); - return result; } else { result.success = false; result.comment = getResourceHelper().gs(R.string.danar_valuenotsetproperly); getAapsLogger().error("cancelExtendedBolus: Failed to cancel extended bolus"); - return result; } + return result; } @Override diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java index 3464d98e2a..c5db1bc8ce 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java +++ b/danar/src/main/java/info/nightscout/androidaps/danar/DanaRPlugin.java @@ -312,7 +312,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { } // Now set new extended, no need to to stop previous (if running) because it's replaced - Double extendedAmount = extendedRateToSet / 2 * durationInHalfHours; + double extendedAmount = extendedRateToSet / 2 * durationInHalfHours; aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: Setting extended: " + extendedAmount + "U halfhours: " + durationInHalfHours); result = setExtendedBolus(extendedAmount, durationInMinutes); if (!result.success) { diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java index 65d76859b1..9552b6ad29 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java @@ -10,7 +10,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.preference.Preference; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import org.joda.time.LocalDateTime; import java.util.ArrayList; @@ -202,7 +202,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter } @Override - public void updatePreferenceSummary(@NotNull Preference pref) { + public void updatePreferenceSummary(@NonNull Preference pref) { super.updatePreferenceSummary(pref); if (pref.getKey().equals(getResourceHelper().gs(R.string.key_rileylink_mac_address))) { diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java index c3f2050805..8af98fd4bc 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BasalProfile.java @@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.medtronic.data.dto; import com.google.gson.annotations.Expose; +import androidx.annotation.NonNull; import org.joda.time.Instant; import java.util.ArrayList; @@ -219,7 +220,6 @@ public class BasalProfile { aapsLogger.warn(LTag.PUMPCOMM,"Raw Data is empty."); return entries; // an empty list } - boolean done = false; int r, st; for (int i = 0; i < mRawData.length - 2; i += 3) { @@ -312,7 +312,7 @@ public class BasalProfile { currentTime = (currentTime * 30) / 60; - int lastHour = 0; + int lastHour; if ((i + 1) == entries.size()) { lastHour = 24; } else { @@ -357,7 +357,7 @@ public class BasalProfile { } - public String toString() { + @NonNull public String toString() { return basalProfileToString(); } diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BatteryStatusDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BatteryStatusDTO.java index ed0ff2bad1..835d43c072 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BatteryStatusDTO.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/BatteryStatusDTO.java @@ -2,6 +2,8 @@ package info.nightscout.androidaps.plugins.pump.medtronic.data.dto; import com.google.gson.annotations.Expose; +import androidx.annotation.NonNull; + import java.util.Locale; import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType; @@ -29,7 +31,7 @@ public class BatteryStatusDTO { int percentInt = (int) (percent * 100.0d); - if (percentInt<0) + if (percentInt < 0) percentInt = 1; if (percentInt > 100) @@ -39,7 +41,7 @@ public class BatteryStatusDTO { } - public String toString() { + @NonNull public String toString() { return String.format(Locale.ENGLISH, "BatteryStatusDTO [voltage=%.2f, alkaline=%d, lithium=%d, niZn=%d, nimh=%d]", voltage == null ? 0.0f : voltage, getCalculatedPercent(BatteryType.Alkaline), diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java index 11bd57d017..72c3af8a6b 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/DailyTotalsDTO.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.medtronic.data.dto; +import androidx.annotation.NonNull; + import com.google.gson.annotations.Expose; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -205,7 +207,7 @@ public class DailyTotalsDTO { //LOG.debug("523: {}", toString()); } - @Override + @Override @NonNull public String toString() { return new ToStringBuilder(this) .append("bgAvg", bgAvg) diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java index 983f428a8f..5fa8f3966e 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/data/dto/TempBasalPair.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.medtronic.data.dto; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.List; @@ -120,7 +120,7 @@ public class TempBasalPair extends info.nightscout.androidaps.plugins.pump.commo } - @NotNull @Override + @NonNull @Override public String toString() { return "TempBasalPair [" + "Rate=" + insulinRate + ", DurationMinutes=" + durationMinutes + ", IsPercent=" + isPercent + "]"; diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java index 9d9a86b735..9f1d2a092b 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.pump.medtronic.driver; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import java.util.Calendar; import java.util.Date; @@ -160,7 +160,7 @@ public class MedtronicPumpStatus extends info.nightscout.androidaps.plugins.pump return BatteryType.None; } - @NotNull + @NonNull public String getErrorInfo() { return (errorDescription == null) ? "-" : errorDescription; } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.java index 3f6ce6d099..c9c96fbebc 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command; +import androidx.annotation.NonNull; + import java.nio.ByteBuffer; import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.CommandType; @@ -23,7 +25,7 @@ public final class DeactivateCommand extends NonceEnabledCommand { .array()); } - @Override public String toString() { + @Override @NonNull public String toString() { return "DeactivateCommand{" + "nonce=" + nonce + ", commandType=" + commandType + diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.java index 4fce0c11a2..20330549d9 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command; +import androidx.annotation.NonNull; + import java.nio.ByteBuffer; import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.CommandType; @@ -25,7 +27,7 @@ public final class GetVersionCommand extends HeaderEnabledCommand { .array()); } - @Override public String toString() { + @Override @NonNull public String toString() { return "GetVersionCommand{" + "commandType=" + commandType + ", uniqueId=" + uniqueId + diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlertConfiguration.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlertConfiguration.java index 8a52836d58..b0341235c7 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlertConfiguration.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlertConfiguration.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition; +import androidx.annotation.NonNull; + import java.nio.ByteBuffer; public class AlertConfiguration implements Encodable { @@ -45,7 +47,7 @@ public class AlertConfiguration implements Encodable { .array(); } - @Override public String toString() { + @NonNull @Override public String toString() { return "AlertConfiguration{" + "slot=" + slot + ", enabled=" + enabled + diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponse.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponse.java index bb7ce23766..ba46f8b9b0 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponse.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponse.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response; +import androidx.annotation.NonNull; + import java.nio.ByteBuffer; import java.util.Arrays; @@ -200,7 +202,7 @@ public class AlarmStatusResponse extends AdditionalStatusResponseBase { return returnAddressOfPodAlarmHandlerCaller; } - @Override public String toString() { + @NonNull @Override public String toString() { return "AlarmStatusResponse{" + "messageType=" + messageType + ", messageLength=" + messageLength + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AcknowledgeAlertsCommand.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AcknowledgeAlertsCommand.java index 1f11a10f92..9661957f6d 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AcknowledgeAlertsCommand.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AcknowledgeAlertsCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; +import androidx.annotation.NonNull; + import java.util.Collections; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; @@ -44,7 +46,7 @@ public class AcknowledgeAlertsCommand extends NonceResyncableMessageBlock { encode(); } - @Override + @NonNull @Override public String toString() { return "AcknowledgeAlertsCommand{" + "alerts=" + alerts + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AssignAddressCommand.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AssignAddressCommand.java index 72ac2f4f89..c3c6cfc46c 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AssignAddressCommand.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/AssignAddressCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; +import androidx.annotation.NonNull; + import java.nio.ByteBuffer; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.MessageBlock; @@ -22,7 +24,7 @@ public class AssignAddressCommand extends MessageBlock { return MessageBlockType.ASSIGN_ADDRESS; } - @Override + @NonNull @Override public String toString() { return "AssignAddressCommand{" + "address=" + address + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BasalScheduleExtraCommand.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BasalScheduleExtraCommand.java index e9ca5f916e..dd6f1f965a 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BasalScheduleExtraCommand.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BasalScheduleExtraCommand.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; +import androidx.annotation.NonNull; import org.joda.time.Duration; import java.util.ArrayList; @@ -112,7 +113,7 @@ public class BasalScheduleExtraCommand extends MessageBlock { return new ArrayList<>(rateEntries); } - @Override + @NonNull @Override public String toString() { return "BasalScheduleExtraCommand{" + "acknowledgementBeep=" + acknowledgementBeep + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BeepConfigCommand.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BeepConfigCommand.java index a05a7563f0..fd94fad4fc 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BeepConfigCommand.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/BeepConfigCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; +import androidx.annotation.NonNull; + import org.joda.time.Duration; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; @@ -42,7 +44,7 @@ public class BeepConfigCommand extends MessageBlock { return MessageBlockType.BEEP_CONFIG; } - @Override + @Override @NonNull public String toString() { return "BeepConfigCommand{" + "beepType=" + beepType + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/ConfigureAlertsCommand.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/ConfigureAlertsCommand.java index 86fdc6c062..82daa20180 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/ConfigureAlertsCommand.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/ConfigureAlertsCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; +import androidx.annotation.NonNull; + import java.util.List; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; @@ -40,7 +42,7 @@ public class ConfigureAlertsCommand extends NonceResyncableMessageBlock { encode(); } - @Override + @Override @NonNull public String toString() { return "ConfigureAlertsCommand{" + "configurations=" + configurations + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/DeactivatePodCommand.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/DeactivatePodCommand.java index 853e0520a0..c811970321 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/DeactivatePodCommand.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/DeactivatePodCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; +import androidx.annotation.NonNull; + import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.NonceResyncableMessageBlock; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.MessageBlockType; @@ -32,7 +34,7 @@ public class DeactivatePodCommand extends NonceResyncableMessageBlock { encode(); } - @Override + @Override @NonNull public String toString() { return "DeactivatePodCommand{" + "nonce=" + nonce + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/FaultConfigCommand.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/FaultConfigCommand.java index 0c4ae4cfd0..dc8fcec55a 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/FaultConfigCommand.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/FaultConfigCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; +import androidx.annotation.NonNull; + import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.NonceResyncableMessageBlock; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.MessageBlockType; @@ -39,7 +41,7 @@ public class FaultConfigCommand extends NonceResyncableMessageBlock { encode(); } - @Override + @Override @NonNull public String toString() { return "FaultConfigCommand{" + "tab5sub16=" + tab5sub16 + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/GetStatusCommand.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/GetStatusCommand.java index e8694f83d3..fe5fb5592e 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/GetStatusCommand.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/command/GetStatusCommand.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.command; +import androidx.annotation.NonNull; + import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.MessageBlock; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.MessageBlockType; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodInfoType; @@ -21,7 +23,7 @@ public class GetStatusCommand extends MessageBlock { return MessageBlockType.GET_STATUS; } - @Override + @Override @NonNull public String toString() { return "GetStatusCommand{" + "podInfoType=" + podInfoType + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/ErrorResponse.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/ErrorResponse.java index dc70160bed..ebdab8f912 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/ErrorResponse.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/ErrorResponse.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.response; +import androidx.annotation.NonNull; + import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.MessageBlock; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FaultEventCode; @@ -60,7 +62,7 @@ public class ErrorResponse extends MessageBlock { return nonceSearchKey; } - @Override public String toString() { + @Override @NonNull public String toString() { return "ErrorResponse{" + "errorResponseCode=" + errorResponseCode + ", nonceSearchKey=" + nonceSearchKey + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertConfiguration.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertConfiguration.java index 2432429f6a..c9518b0608 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertConfiguration.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertConfiguration.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition; +import androidx.annotation.NonNull; import org.joda.time.Duration; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; @@ -34,6 +35,7 @@ public class AlertConfiguration { return alertSlot; } + @SuppressWarnings("unused") public AlertTrigger getAlertTrigger() { return alertTrigger; } @@ -75,7 +77,7 @@ public class AlertConfiguration { return encodedData; } - @Override public String toString() { + @NonNull @Override public String toString() { return "AlertConfiguration{" + "alertType=" + alertType + ", alertSlot=" + alertSlot + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertSet.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertSet.java index 05ae2b34f5..b892aa0ff0 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertSet.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertSet.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition; +import androidx.annotation.NonNull; + import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -51,7 +53,7 @@ public class AlertSet { return Objects.hash(alertSlots); } - @Override + @NonNull @Override public String toString() { return "AlertSet{" + "alertSlots=" + alertSlots + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertTrigger.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertTrigger.java index 26146f179e..cafa6fa275 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertTrigger.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/AlertTrigger.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition; +import androidx.annotation.NonNull; + public abstract class AlertTrigger { private final T value; @@ -11,7 +13,7 @@ public abstract class AlertTrigger { return value; } - @Override public String toString() { + @NonNull @Override public String toString() { return "AlertTrigger{" + "value=" + value + '}'; diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/FirmwareVersion.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/FirmwareVersion.java index 6ea7cb332e..16b6bc7922 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/FirmwareVersion.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/FirmwareVersion.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition; +import androidx.annotation.NonNull; + import java.util.Locale; public class FirmwareVersion { @@ -13,7 +15,7 @@ public class FirmwareVersion { this.patch = patch; } - @Override + @Override @NonNull public String toString() { return String.format(Locale.getDefault(), "%d.%d.%d", major, minor, patch); } diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalDeliverySchedule.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalDeliverySchedule.java index e65cd4c40b..56ee29c546 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalDeliverySchedule.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalDeliverySchedule.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule; +import androidx.annotation.NonNull; + import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.IRawRepresentable; @@ -49,7 +51,7 @@ public class BasalDeliverySchedule extends DeliverySchedule implements IRawRepre return checksum; } - @Override + @NonNull @Override public String toString() { return "BasalDeliverySchedule{" + "currentSegment=" + currentSegment + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalDeliveryTable.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalDeliveryTable.java index 20b54a4214..8e40c31ba1 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalDeliveryTable.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalDeliveryTable.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule; +import androidx.annotation.NonNull; import org.joda.time.Duration; import java.util.ArrayList; @@ -90,7 +91,7 @@ public class BasalDeliveryTable { return numSegments; } - @Override + @NonNull @Override public String toString() { return "BasalDeliveryTable{" + "entries=" + entries + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalSchedule.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalSchedule.java index f960a6303f..23e7704bdb 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalSchedule.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalSchedule.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule; +import androidx.annotation.NonNull; import org.joda.time.Duration; import java.util.ArrayList; @@ -85,7 +86,7 @@ public class BasalSchedule { return durations; } - @Override + @NonNull @Override public String toString() { return "BasalSchedule{" + "entries=" + entries + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalScheduleEntry.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalScheduleEntry.java index 1c75fde904..88c92508dc 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalScheduleEntry.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalScheduleEntry.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule; +import androidx.annotation.NonNull; import org.joda.time.Duration; import java.util.Objects; @@ -32,7 +33,7 @@ public class BasalScheduleEntry { return startTime; } - @Override + @NonNull @Override public String toString() { return "BasalScheduleEntry{" + "rate=" + rate + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalTableEntry.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalTableEntry.java index 1f0485bdfd..5fbb5a20b1 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalTableEntry.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BasalTableEntry.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule; +import androidx.annotation.NonNull; + import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communication.message.IRawRepresentable; @@ -42,7 +44,7 @@ public class BasalTableEntry implements IRawRepresentable { return alternateSegmentPulse; } - @Override + @NonNull @Override public String toString() { return "BasalTableEntry{" + "segments=" + segments + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BolusDeliverySchedule.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BolusDeliverySchedule.java index 1698bf98bf..a4c98cae00 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BolusDeliverySchedule.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/definition/schedule/BolusDeliverySchedule.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule; +import androidx.annotation.NonNull; + import org.joda.time.Duration; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; @@ -50,7 +52,7 @@ public class BolusDeliverySchedule extends DeliverySchedule implements IRawRepre return checksum; } - @Override + @Override @NonNull public String toString() { return "BolusDeliverySchedule{" + "units=" + units + diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java index 96afb81db3..77a71f6714 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodHistoryActivity.java @@ -13,7 +13,7 @@ import android.widget.TextView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.Calendar; @@ -198,7 +198,7 @@ public class ErosPodHistoryActivity extends NoSplashAppCompatActivity { this.name = entryGroup.getTranslated(); } - @NotNull + @NonNull @Override public String toString() { return name; @@ -220,7 +220,7 @@ public class ErosPodHistoryActivity extends NoSplashAppCompatActivity { } - @NotNull + @NonNull @Override public HistoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.omnipod_eros_pod_history_item, // @@ -230,7 +230,7 @@ public class ErosPodHistoryActivity extends NoSplashAppCompatActivity { @Override - public void onBindViewHolder(@NotNull HistoryViewHolder holder, int position) { + public void onBindViewHolder(@NonNull HistoryViewHolder holder, int position) { OmnipodHistoryRecord record = historyList.get(position); if (record != null) { diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/BleAdvertisedData.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/BleAdvertisedData.java index 15498316bf..5f63414eab 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/BleAdvertisedData.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/data/BleAdvertisedData.java @@ -1,5 +1,7 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data; +import androidx.annotation.NonNull; + import java.util.List; import java.util.UUID; @@ -29,7 +31,7 @@ public class BleAdvertisedData { } - public String toString() { + @NonNull public String toString() { return "BleAdvertisedData [name=" + mName + ", UUIDs=" + mUuids + "]"; } } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java index 1010558316..882f7a84ca 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusActivity.java @@ -10,7 +10,7 @@ import androidx.viewpager.widget.ViewPager; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.tabs.TabLayout; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.List; @@ -80,7 +80,7 @@ public class RileyLinkStatusActivity extends NoSplashAppCompatActivity { super(fm); } - @NotNull @Override + @NonNull @Override public Fragment getItem(int position) { this.lastSelectedPosition = position; return fragmentList.get(position); diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java index a59cfbfb78..452c99f905 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusHistoryFragment.java @@ -9,7 +9,7 @@ import android.widget.TextView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.Collections; @@ -120,7 +120,7 @@ public class RileyLinkStatusHistoryFragment extends DaggerFragment implements Re } - @NotNull + @NonNull @Override public RecyclerViewAdapter.HistoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.rileylink_status_history_item, // diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java index b15da2d175..378f478643 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java @@ -4,7 +4,7 @@ import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.content.Intent; -import org.jetbrains.annotations.NotNull; +import androidx.annotation.NonNull; import javax.inject.Inject; @@ -236,7 +236,7 @@ public abstract class RileyLinkService extends DaggerService { rileyLinkServiceData.setRileyLinkServiceState(RileyLinkServiceState.BluetoothReady); } - @NotNull public RileyLinkBLE getRileyLinkBLE() { + @NonNull public RileyLinkBLE getRileyLinkBLE() { return rileyLinkBLE; } diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java index 492e77cd05..b29f88bab0 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BIGChart.java @@ -208,7 +208,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre } private boolean isLowRes(WatchMode watchMode) { - return (watchMode == WatchMode.LOW_BIT) || (watchMode == WatchMode.LOW_BIT_BURN_IN) || (watchMode == WatchMode.LOW_BIT_BURN_IN); + return (watchMode == WatchMode.LOW_BIT) || (watchMode == WatchMode.LOW_BIT_BURN_IN); } diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java index f879701661..9e56a8aa21 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/NOChart.java @@ -172,7 +172,7 @@ public class NOChart extends WatchFace implements SharedPreferences.OnSharedPref } private boolean isLowRes(WatchMode watchMode) { - return (watchMode == WatchMode.LOW_BIT) || (watchMode == WatchMode.LOW_BIT_BURN_IN) || (watchMode == WatchMode.LOW_BIT_BURN_IN); + return (watchMode == WatchMode.LOW_BIT) || (watchMode == WatchMode.LOW_BIT_BURN_IN); } diff --git a/wear/src/test/java/info/nightscout/androidaps/data/BgWatchDataTest.java b/wear/src/test/java/info/nightscout/androidaps/data/BgWatchDataTest.java index e920dc3202..269f72db20 100644 --- a/wear/src/test/java/info/nightscout/androidaps/data/BgWatchDataTest.java +++ b/wear/src/test/java/info/nightscout/androidaps/data/BgWatchDataTest.java @@ -36,7 +36,7 @@ public class BgWatchDataTest { // GIVEN BgWatchData inserted = new BgWatchData( 88.0, 160.0, 90.0, - WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*4*1, 1 + WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS * 4, 1 ); Set set = new HashSet<>(); @@ -76,7 +76,7 @@ public class BgWatchDataTest { assertNotEquals(item1, item3sameTimeSameDiffColor); assertNotEquals(item1, item4differentTime); - assertFalse(item1.equals("aa bbb")); + assertNotEquals("aa bbb", item1); } /** diff --git a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.java b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.java index ce63330e9c..98b7f99297 100644 --- a/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.java +++ b/wear/src/test/java/info/nightscout/androidaps/interaction/utils/PairTest.java @@ -39,7 +39,7 @@ public class PairTest { assertNotEquals(no1, no3); assertEquals(no1, no4); - assertFalse(left.equals("aa bbb")); + assertNotEquals("aa bbb", left); } @Test @@ -49,6 +49,7 @@ public class PairTest { Set set = new HashSet<>(); // THEN + //noinspection ConstantConditions assertFalse(set.contains(inserted)); set.add(inserted); assertTrue(set.contains(inserted)); diff --git a/wear/src/test/java/info/nightscout/androidaps/testing/utils/BasalWatchDataExt.java b/wear/src/test/java/info/nightscout/androidaps/testing/utils/BasalWatchDataExt.java index 9a23f491d9..6aec341ab3 100644 --- a/wear/src/test/java/info/nightscout/androidaps/testing/utils/BasalWatchDataExt.java +++ b/wear/src/test/java/info/nightscout/androidaps/testing/utils/BasalWatchDataExt.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.testing.utils; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import java.util.Objects; @@ -36,7 +37,7 @@ public class BasalWatchDataExt extends BasalWatchData { @Override public boolean equals(@Nullable Object obj) { - if ((obj instanceof BasalWatchData)||(obj instanceof BasalWatchDataExt)) { + if (obj instanceof BasalWatchData) { return (this.startTime == ((BasalWatchData) obj).startTime) && (this.endTime == ((BasalWatchData) obj).endTime) && (this.amount == ((BasalWatchData) obj).amount); @@ -45,7 +46,7 @@ public class BasalWatchDataExt extends BasalWatchData { } } - @Override + @NonNull @Override public String toString() { return startTime+", "+endTime+", "+amount; } diff --git a/wear/src/test/java/info/nightscout/androidaps/testing/utils/BgWatchDataExt.java b/wear/src/test/java/info/nightscout/androidaps/testing/utils/BgWatchDataExt.java index c49125809e..406d76695e 100644 --- a/wear/src/test/java/info/nightscout/androidaps/testing/utils/BgWatchDataExt.java +++ b/wear/src/test/java/info/nightscout/androidaps/testing/utils/BgWatchDataExt.java @@ -1,5 +1,6 @@ package info.nightscout.androidaps.testing.utils; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import java.util.Objects; @@ -42,7 +43,7 @@ public class BgWatchDataExt extends BgWatchData { @Override public boolean equals(@Nullable Object obj) { - if ((obj instanceof BgWatchData)||(obj instanceof BgWatchDataExt)) { + if (obj instanceof BgWatchData) { return (this.sgv == ((BgWatchData) obj).sgv) && (this.high == ((BgWatchData) obj).high) && (this.low == ((BgWatchData) obj).low) @@ -53,7 +54,7 @@ public class BgWatchDataExt extends BgWatchData { } } - @Override + @Override @NonNull public String toString() { return sgv+", "+high+", "+low+", "+timestamp+", "+color; }