[infrastructure] move infered nullness warnings to error and update EEA (#8949)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K
2020-11-12 21:07:11 +01:00
committed by GitHub
parent 0856a0b3f2
commit ba4c96d99d
155 changed files with 644 additions and 632 deletions

View File

@@ -131,7 +131,10 @@ public class WebSocketConnection {
return;
}
listener.messageReceived(changedMessage.id, gson.fromJson(message, expectedMessageType));
DeconzBaseMessage deconzMessage = gson.fromJson(message, expectedMessageType);
if (deconzMessage != null) {
listener.messageReceived(changedMessage.id, deconzMessage);
}
}
@OnWebSocketError

View File

@@ -30,9 +30,8 @@ import com.google.gson.JsonParseException;
@NonNullByDefault
public class GroupTypeDeserializer implements JsonDeserializer<GroupType> {
@Override
public GroupType deserialize(@Nullable JsonElement json, @Nullable Type typeOfT,
@Nullable JsonDeserializationContext context) throws JsonParseException {
String s = json != null ? json.getAsString() : null;
return s == null ? GroupType.UNKNOWN : GroupType.fromString(s);
public @Nullable GroupType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return GroupType.fromString(json.getAsString());
}
}

View File

@@ -30,9 +30,8 @@ import com.google.gson.JsonParseException;
@NonNullByDefault
public class LightTypeDeserializer implements JsonDeserializer<LightType> {
@Override
public LightType deserialize(@Nullable JsonElement json, @Nullable Type typeOfT,
@Nullable JsonDeserializationContext context) throws JsonParseException {
String s = json != null ? json.getAsString() : null;
return s == null ? LightType.UNKNOWN : LightType.fromString(s);
public @Nullable LightType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return LightType.fromString(json.getAsString());
}
}

View File

@@ -30,9 +30,8 @@ import com.google.gson.JsonParseException;
@NonNullByDefault
public class ResourceTypeDeserializer implements JsonDeserializer<ResourceType> {
@Override
public ResourceType deserialize(@Nullable JsonElement json, @Nullable Type typeOfT,
@Nullable JsonDeserializationContext context) throws JsonParseException {
String s = json != null ? json.getAsString() : null;
return s == null ? ResourceType.UNKNOWN : ResourceType.fromString(s);
public @Nullable ResourceType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return ResourceType.fromString(json.getAsString());
}
}

View File

@@ -34,19 +34,14 @@ import com.google.gson.JsonSerializer;
@NonNullByDefault
public class ThermostatModeGsonTypeAdapter implements JsonDeserializer<ThermostatMode>, JsonSerializer<ThermostatMode> {
@Override
public ThermostatMode deserialize(@Nullable JsonElement json, @Nullable Type typeOfT,
@Nullable JsonDeserializationContext context) throws JsonParseException {
JsonElement jsonLocal = json;
if (jsonLocal != null) {
String s = jsonLocal.getAsString();
return s == null ? ThermostatMode.UNKNOWN : ThermostatMode.fromString(s);
}
return ThermostatMode.UNKNOWN;
public @Nullable ThermostatMode deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return ThermostatMode.fromString(json.getAsString());
}
@Override
public JsonElement serialize(ThermostatMode src, @Nullable Type typeOfSrc,
@Nullable JsonSerializationContext context) throws JsonParseException {
public JsonElement serialize(ThermostatMode src, Type typeOfSrc, JsonSerializationContext context)
throws JsonParseException {
return src != ThermostatMode.UNKNOWN ? new JsonPrimitive(src.getDeconzValue()) : JsonNull.INSTANCE;
}
}