mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Upgrade SAT plugin to 0.16.0 (#16582)
Modify code which leads to build error with new version of SpotBugs. Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
parent
b77172c6bb
commit
df884ac643
@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
@ -38,14 +39,14 @@ public abstract class GattSocket<T extends GattMessage, R extends GattMessage> {
|
||||
|
||||
private final Deque<MessageProcessor> messageProcessors = new ConcurrentLinkedDeque<>();
|
||||
|
||||
public void registerMessageHandler(MessageHandler<T, R> messageHandler) {
|
||||
public void registerMessageHandler(MessageHandler<@NonNull T, @NonNull R> messageHandler) {
|
||||
// we need to use a dummy future since ConcurrentHashMap doesn't allow null values
|
||||
messageProcessors.addFirst(new MessageProcessor(messageHandler, COMPLETED_FUTURE));
|
||||
}
|
||||
|
||||
protected abstract ScheduledExecutorService getScheduler();
|
||||
|
||||
public void sendMessage(MessageServicer<T, R> messageServicer) {
|
||||
public void sendMessage(MessageServicer<@NonNull T, @NonNull R> messageServicer) {
|
||||
T message = messageServicer.createMessage();
|
||||
|
||||
CompletableFuture<@Nullable Void> messageFuture = sendMessage(message);
|
||||
@ -106,10 +107,10 @@ public abstract class GattSocket<T extends GattMessage, R extends GattMessage> {
|
||||
}
|
||||
|
||||
private class MessageProcessor {
|
||||
private MessageHandler<T, R> messageHandler;
|
||||
private MessageHandler<@NonNull T, @NonNull R> messageHandler;
|
||||
private Future<?> timeoutFuture;
|
||||
|
||||
public MessageProcessor(MessageHandler<T, R> messageHandler, Future<?> timeoutFuture) {
|
||||
public MessageProcessor(MessageHandler<@NonNull T, @NonNull R> messageHandler, Future<?> timeoutFuture) {
|
||||
this.messageHandler = messageHandler;
|
||||
this.timeoutFuture = timeoutFuture;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class ThingTypeTableGenerator {
|
||||
// write actual rows
|
||||
rows.forEach(row -> {
|
||||
writer.append(writeRow(maxColumns, row, ' ')).append('\n');
|
||||
if (row == headerRow) {
|
||||
if (headerRow.equals(row)) {
|
||||
writer.append(writeRow(maxColumns, new String[] { "", "", "" }, '-')).append('\n');
|
||||
}
|
||||
});
|
||||
|
@ -17,6 +17,7 @@ import static org.openhab.binding.freeboxos.internal.FreeboxOsBindingConstants.B
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.freeboxos.internal.api.FreeboxException;
|
||||
@ -167,7 +168,8 @@ public class HomeManager extends RestManager {
|
||||
}
|
||||
|
||||
public <T> boolean putCommand(int nodeId, int stateSignalId, T value) throws FreeboxException {
|
||||
put(new EndpointValue<>(value), ENDPOINTS_PATH, String.valueOf(nodeId), String.valueOf(stateSignalId));
|
||||
put(new EndpointValue<@NonNull T>(value), ENDPOINTS_PATH, String.valueOf(nodeId),
|
||||
String.valueOf(stateSignalId));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ public class Clip2Bridge implements Closeable {
|
||||
@Override
|
||||
public void onGoAway(@Nullable Session session, @Nullable GoAwayFrame frame) {
|
||||
Objects.requireNonNull(session);
|
||||
if (http2Session == session) {
|
||||
if (session.equals(http2Session)) {
|
||||
Thread recreateThread = new Thread(() -> recreateSession());
|
||||
Clip2Bridge.this.recreateThread = recreateThread;
|
||||
recreateThread.start();
|
||||
@ -412,7 +412,7 @@ public class Clip2Bridge implements Closeable {
|
||||
public void onPing(@Nullable Session session, @Nullable PingFrame frame) {
|
||||
Objects.requireNonNull(session);
|
||||
Objects.requireNonNull(frame);
|
||||
if (http2Session == session) {
|
||||
if (session.equals(http2Session)) {
|
||||
checkAliveOk();
|
||||
if (!frame.isReply()) {
|
||||
session.ping(new PingFrame(true), Callback.NOOP);
|
||||
|
@ -221,8 +221,8 @@ public class MqttTopicClassMapperTests {
|
||||
"homie/device123", fieldChangedObserverMock, 10);
|
||||
assertThat(future.isDone(), is(true));
|
||||
|
||||
SubscribeFieldToMQTTtopic field = attributes.subscriptions.stream().filter(f -> f.field.getName() == "state")
|
||||
.findFirst().get();
|
||||
SubscribeFieldToMQTTtopic field = attributes.subscriptions.stream()
|
||||
.filter(f -> "state".equals(f.field.getName())).findFirst().get();
|
||||
field.processMessage(field.topic, "garbage".getBytes());
|
||||
verify(fieldChangedObserverMock, times(0)).attributeChanged(any(), any(), any(), any(), anyBoolean());
|
||||
assertThat(attributes.state.toString(), is("unknown"));
|
||||
|
@ -16,6 +16,7 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.omnilink.internal.exceptions.BridgeOfflineException;
|
||||
import org.openhab.binding.omnilink.internal.handler.OmnilinkBridgeHandler;
|
||||
@ -42,14 +43,14 @@ public class ObjectPropertyRequest<T extends ObjectProperties> implements Iterab
|
||||
}
|
||||
|
||||
private final OmnilinkBridgeHandler bridgeHandler;
|
||||
private final ObjectPropertyRequests<T> request;
|
||||
private final ObjectPropertyRequests<@NonNull T> request;
|
||||
private final int objectNumber;
|
||||
private final int filter1;
|
||||
private final int filter2;
|
||||
private final int filter3;
|
||||
private final int offset;
|
||||
|
||||
private ObjectPropertyRequest(OmnilinkBridgeHandler bridgeHandler, ObjectPropertyRequests<T> request,
|
||||
private ObjectPropertyRequest(OmnilinkBridgeHandler bridgeHandler, ObjectPropertyRequests<@NonNull T> request,
|
||||
int objectNumber, int filter1, int filter2, int filter3, int offset) {
|
||||
this.bridgeHandler = bridgeHandler;
|
||||
this.request = request;
|
||||
|
@ -40,7 +40,7 @@ public abstract class AbstractRioHandlerCallback implements RioHandlerCallback {
|
||||
@Override
|
||||
public void removeListener(String channelId, RioHandlerCallbackListener listener) {
|
||||
for (ListenerState listenerState : listeners) {
|
||||
if (listenerState.channelId.equals(channelId) && listenerState.listener == listener) {
|
||||
if (listenerState.channelId.equals(channelId) && listener.equals(listenerState.listener)) {
|
||||
listeners.remove(listenerState);
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public class RemoteControllerLegacy extends RemoteController {
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
return socket != null && !socket.isClosed() && socket != null && socket.isConnected();
|
||||
return socket != null && !socket.isClosed() && socket.isConnected();
|
||||
}
|
||||
|
||||
private String createRegistrationPayload(String ip) throws IOException {
|
||||
|
@ -15,6 +15,7 @@ package org.openhab.binding.spotify.internal.handler;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
@ -41,9 +42,9 @@ public class SpotifyDynamicStateDescriptionProvider extends BaseDynamicStateDesc
|
||||
public void setDevices(ChannelUID channelUID, List<Device> spotifyDevices) {
|
||||
final List<Device> devices = devicesByChannel.get(channelUID);
|
||||
|
||||
if (devices == null || (spotifyDevices.size() != devices.size()
|
||||
|| !spotifyDevices.stream().allMatch(sd -> devices.stream().anyMatch(
|
||||
d -> sd.getId() == d.getId() && d.getName() != null && d.getName().equals(sd.getName()))))) {
|
||||
if (devices == null || (spotifyDevices.size() != devices.size() || !spotifyDevices.stream()
|
||||
.allMatch(sd -> devices.stream().anyMatch(d -> Objects.equals(sd.getId(), d.getId())
|
||||
&& d.getName() != null && d.getName().equals(sd.getName()))))) {
|
||||
devicesByChannel.put(channelUID, spotifyDevices);
|
||||
setStateOptions(channelUID, spotifyDevices.stream()
|
||||
.map(device -> new StateOption(device.getId(), device.getName())).collect(Collectors.toList()));
|
||||
|
@ -20,6 +20,7 @@ import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.verisure.internal.DeviceStatusListener;
|
||||
@ -51,7 +52,7 @@ import com.google.gson.Gson;
|
||||
*
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public abstract class VerisureThingHandler<T extends VerisureThingDTO> extends BaseThingHandler
|
||||
public abstract class VerisureThingHandler<@NonNull T extends VerisureThingDTO> extends BaseThingHandler
|
||||
implements DeviceStatusListener<T> {
|
||||
|
||||
protected final Logger logger = LoggerFactory.getLogger(VerisureThingHandler.class);
|
||||
|
2
pom.xml
2
pom.xml
@ -80,7 +80,7 @@
|
||||
<okio.version>3.9.0</okio.version>
|
||||
<gson.version>2.9.1</gson.version>
|
||||
<kotlin.version>1.9.23</kotlin.version>
|
||||
<sat.version>0.15.0</sat.version>
|
||||
<sat.version>0.16.0</sat.version>
|
||||
<slf4j.version>2.0.7</slf4j.version>
|
||||
<spotless.version>2.38.0</spotless.version>
|
||||
<!-- Eclipse Java formatter version 4.26+ does not check test files -->
|
||||
|
Loading…
Reference in New Issue
Block a user