Java 17 features (N-S) (#15565)

- add missing @override
- Java style array syntax
- remove redundant modifiers
- always move String constants to left side in comparisons
- simplify lambda expressions and return statements
- use replace instead of replaceAll w/o regex
- instanceof matching and multiline strings

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich
2023-09-13 08:03:31 +02:00
committed by GitHub
parent 641b482551
commit ab58f4ffb4
471 changed files with 1624 additions and 1868 deletions

View File

@@ -64,8 +64,8 @@ public class SomfyMyLinkDeviceDiscoveryService extends AbstractDiscoveryService
@Override
public void setThingHandler(@Nullable ThingHandler handler) {
if (handler instanceof SomfyMyLinkBridgeHandler) {
this.mylinkHandler = (SomfyMyLinkBridgeHandler) handler;
if (handler instanceof SomfyMyLinkBridgeHandler bridgeHandler) {
this.mylinkHandler = bridgeHandler;
}
}

View File

@@ -25,9 +25,9 @@ import java.net.SocketTimeoutException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@@ -145,7 +145,7 @@ public class SomfyMyLinkBridgeHandler extends BaseBridgeHandler {
@Override
public Collection<Class<? extends ThingHandlerService>> getServices() {
return Collections.singleton(SomfyMyLinkDeviceDiscoveryService.class);
return Set.of(SomfyMyLinkDeviceDiscoveryService.class);
}
private boolean validConfiguration(@Nullable SomfyMyLinkConfiguration config) {