@JvmDefault warning resolve

This commit is contained in:
Milos Kozak 2021-05-18 23:02:40 +02:00
parent b548325059
commit fceed4e4fd
4 changed files with 27 additions and 34 deletions

View file

@ -76,7 +76,7 @@ allprojects {
//Support @JvmDefault
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs = ['-Xjvm-default=enable'] //enable or compatibility
freeCompilerArgs = ['-Xjvm-default=all']
jvmTarget = "1.8"
}
}

View file

@ -6,8 +6,6 @@ import android.os.SystemClock;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import info.nightscout.androidaps.extensions.PumpStateExtensionKt;
import org.joda.time.DateTime;
import org.json.JSONObject;
@ -25,19 +23,19 @@ import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.combo.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.interfaces.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.extensions.PumpStateExtensionKt;
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.Constraints;
import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.Profile;
import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.Pump;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpPluginBase;
import info.nightscout.androidaps.interfaces.PumpSync;
import info.nightscout.androidaps.logging.AAPSLogger;
@ -154,7 +152,6 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
SP sp,
CommandQueueProvider commandQueue,
Context context,
DatabaseHelperInterface databaseHelper,
PumpSync pumpSync,
DateUtil dateUtil
) {

View file

@ -1,7 +1,5 @@
package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.interfaces.Profile
/**
* Constraints interface
*
@ -15,20 +13,20 @@ import info.nightscout.androidaps.interfaces.Profile
*/
interface Constraints {
@JvmDefault fun isLoopInvocationAllowed(value: Constraint<Boolean>): Constraint<Boolean> = value
@JvmDefault fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> = value
@JvmDefault fun isLgsAllowed(value: Constraint<Boolean>): Constraint<Boolean> = value
@JvmDefault fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
@JvmDefault fun isAMAModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
@JvmDefault fun isSMBModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
@JvmDefault fun isUAMEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
@JvmDefault fun isAdvancedFilteringEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
@JvmDefault fun isSuperBolusEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
@JvmDefault fun applyBasalConstraints(absoluteRate: Constraint<Double>, profile: Profile): Constraint<Double> = absoluteRate
@JvmDefault fun applyBasalPercentConstraints(percentRate: Constraint<Int>, profile: Profile): Constraint<Int> = percentRate
@JvmDefault fun applyBolusConstraints(insulin: Constraint<Double>): Constraint<Double> = insulin
@JvmDefault fun applyExtendedBolusConstraints(insulin: Constraint<Double>): Constraint<Double> = insulin
@JvmDefault fun applyCarbsConstraints(carbs: Constraint<Int>): Constraint<Int> = carbs
@JvmDefault fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> = maxIob
@JvmDefault fun isAutomationEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
fun isLoopInvocationAllowed(value: Constraint<Boolean>): Constraint<Boolean> = value
fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> = value
fun isLgsAllowed(value: Constraint<Boolean>): Constraint<Boolean> = value
fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
fun isAMAModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
fun isSMBModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
fun isUAMEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
fun isAdvancedFilteringEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
fun isSuperBolusEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
fun applyBasalConstraints(absoluteRate: Constraint<Double>, profile: Profile): Constraint<Double> = absoluteRate
fun applyBasalPercentConstraints(percentRate: Constraint<Int>, profile: Profile): Constraint<Int> = percentRate
fun applyBolusConstraints(insulin: Constraint<Double>): Constraint<Double> = insulin
fun applyExtendedBolusConstraints(insulin: Constraint<Double>): Constraint<Double> = insulin
fun applyCarbsConstraints(carbs: Constraint<Int>): Constraint<Int> = carbs
fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> = maxIob
fun isAutomationEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
}

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.plugins.common.ManufacturerType
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
@ -52,7 +51,7 @@ interface Pump {
/**
* set initial handshake completed (moved to connected state)
*/
@JvmDefault fun finishHandshaking() {}
fun finishHandshaking() {}
/**
* Perform BT connect, there is new command waiting in queue
@ -69,7 +68,7 @@ interface Pump {
/**
* @return # of second to wait before [disconnect] is send after last command
*/
@JvmDefault fun waitForDisconnectionInSeconds(): Int = 5
fun waitForDisconnectionInSeconds(): Int = 5
/**
* Stop connection process
@ -244,14 +243,14 @@ interface Pump {
*
* @return list of custom actions
*/
@JvmDefault fun getCustomActions(): List<CustomAction>? = null
fun getCustomActions(): List<CustomAction>? = null
/**
* Executes a custom action. Please note that these actions will not be queued
*
* @param customActionType action to be executed
*/
@JvmDefault fun executeCustomAction(customActionType: CustomActionType) {}
fun executeCustomAction(customActionType: CustomActionType) {}
/**
* Executes a custom queued command
@ -260,22 +259,21 @@ interface Pump {
* @param customCommand the custom command to be executed
* @return PumpEnactResult that represents the command execution result
*/
@JvmDefault fun executeCustomCommand(customCommand: CustomCommand): PumpEnactResult? = null
fun executeCustomCommand(customCommand: CustomCommand): PumpEnactResult? = null
/**
* This method will be called when time or Timezone changes, and pump driver can then do a specific action (for
* example update clock on pump).
*/
@JvmDefault fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
/**
* Only used for pump types where hasCustomUnreachableAlertCheck=true
*/
@JvmDefault
fun isUnreachableAlertTimeoutExceeded(alertTimeoutMilliseconds: Long): Boolean = false
/**
* if true APS set 100% basal before full hour to avoid pump beeping
*/
@JvmDefault fun setNeutralTempAtFullHour(): Boolean = false
fun setNeutralTempAtFullHour(): Boolean = false
}