[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

@@ -14,6 +14,7 @@ package org.openhab.binding.mqtt.homeassistant.internal;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -54,7 +55,7 @@ public abstract class BaseChannelConfiguration {
*/
public static <C extends BaseChannelConfiguration> C fromString(final String configJSON, final Gson gson,
final Class<C> clazz) {
return gson.fromJson(configJSON, clazz);
return Objects.requireNonNull(gson.fromJson(configJSON, clazz));
}
/**

View File

@@ -69,10 +69,7 @@ public class ChannelConfigurationTypeAdapterFactory implements TypeAdapterFactor
return new TypeAdapter<T>() {
@Override
public T read(@Nullable JsonReader in) throws IOException {
if (in == null) {
return null;
}
public @Nullable T read(JsonReader in) throws IOException {
/* read the object using the default adapter, but translate the names in the reader */
T result = delegate.read(MappingJsonReader.getConfigMapper(in));
/* do the '~' expansion afterwards */
@@ -81,7 +78,7 @@ public class ChannelConfigurationTypeAdapterFactory implements TypeAdapterFactor
}
@Override
public void write(@Nullable JsonWriter out, T value) throws IOException {
public void write(JsonWriter out, @Nullable T value) throws IOException {
delegate.write(out, value);
}
};
@@ -93,17 +90,14 @@ public class ChannelConfigurationTypeAdapterFactory implements TypeAdapterFactor
return new TypeAdapter<T>() {
@Override
public T read(@Nullable JsonReader in) throws IOException {
if (in == null) {
return null;
}
public @Nullable T read(JsonReader in) throws IOException {
/* read the object using the default adapter, but translate the names in the reader */
T result = delegate.read(MappingJsonReader.getDeviceMapper(in));
return result;
}
@Override
public void write(@Nullable JsonWriter out, T value) throws IOException {
public void write(JsonWriter out, @Nullable T value) throws IOException {
delegate.write(out, value);
}
};