Remove Map null annotation workarounds (#8916)

These workarounds to prevent false positives can be removed now the EEAs allow for proper null analysis.

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2020-11-04 13:57:24 +01:00
committed by GitHub
parent 1dccf67909
commit b423f93b1f
124 changed files with 315 additions and 387 deletions

View File

@@ -71,9 +71,9 @@ public class LcnModuleHandler extends BaseThingHandler {
private static final Map<String, Converter> VALUE_CONVERTERS = new HashMap<>();
private static final InversionConverter INVERSION_CONVERTER = new InversionConverter();
private @Nullable LcnAddrMod moduleAddress;
private final Map<LcnChannelGroup, @Nullable AbstractLcnModuleSubHandler> subHandlers = new HashMap<>();
private final Map<LcnChannelGroup, AbstractLcnModuleSubHandler> subHandlers = new HashMap<>();
private final List<AbstractLcnModuleSubHandler> metadataSubHandlers = new ArrayList<>();
private final Map<ChannelUID, @Nullable Converter> converters = new HashMap<>();
private final Map<ChannelUID, Converter> converters = new HashMap<>();
static {
VALUE_CONVERTERS.put("temperature", Converters.TEMPERATURE);
@@ -123,8 +123,9 @@ public class LcnModuleHandler extends BaseThingHandler {
converters.put(channel.getUID(), new S0Converter(parameterObject));
break;
default:
if (VALUE_CONVERTERS.containsKey(unitObject)) {
converters.put(channel.getUID(), VALUE_CONVERTERS.get(unitObject));
Converter converter = VALUE_CONVERTERS.get(unitObject);
if (converter != null) {
converters.put(channel.getUID(), converter);
}
break;
}

View File

@@ -82,7 +82,7 @@ public class ModInfo {
* Variables request status.
* Lazy initialization: Will be filled once the firmware version is known.
*/
private final Map<Variable, @Nullable RequestStatus> requestStatusVars = new HashMap<>();
private final Map<Variable, RequestStatus> requestStatusVars = new HashMap<>();
/**
* Caches the values of the variables, needed for changing the values.
@@ -291,9 +291,9 @@ public class ModInfo {
}
}
// Variables
for (Map.Entry<Variable, @Nullable RequestStatus> kv : this.requestStatusVars.entrySet()) {
for (Map.Entry<Variable, RequestStatus> kv : this.requestStatusVars.entrySet()) {
RequestStatus requestStatus = kv.getValue();
if (requestStatus != null && requestStatus.shouldSendNextRequest(timeoutMSec, currTime)) {
if (requestStatus.shouldSendNextRequest(timeoutMSec, currTime)) {
// Detect if we can send immediately or if we have to wait for a "typeless" request first
boolean hasTypeInResponse = kv.getKey().hasTypeInResponse(this.firmwareVersion);
if (hasTypeInResponse || this.lastRequestedVarWithoutTypeInResponse == Variable.UNKNOWN) {
@@ -351,9 +351,7 @@ public class ModInfo {
// increase poll interval, if the LCN module sends status updates of a variable event-based
requestStatusVars.entrySet().stream().filter(e -> e.getKey().isEventBased(firmwareVersion)).forEach(e -> {
RequestStatus value = e.getValue();
if (value != null) {
value.setMaxAgeMSec(MAX_STATUS_EVENTBASED_VALUEAGE_MSEC);
}
value.setMaxAgeMSec(MAX_STATUS_EVENTBASED_VALUEAGE_MSEC);
});
}