Java 17 features (H-M) (#15520)

- 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
- remove null check before instanceof

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich
2023-09-08 14:36:59 +02:00
committed by GitHub
parent 3751fd0646
commit edaf17b345
519 changed files with 2703 additions and 2660 deletions

View File

@@ -68,8 +68,7 @@ public class JuiceNetDiscoveryService extends AbstractDiscoveryService
@Override
public void setThingHandler(@Nullable ThingHandler handler) {
if (handler instanceof JuiceNetBridgeHandler) {
JuiceNetBridgeHandler bridgeHandler = (JuiceNetBridgeHandler) handler;
if (handler instanceof JuiceNetBridgeHandler bridgeHandler) {
bridgeHandler.setDiscoveryService(this);
this.bridgeHandler = bridgeHandler;
} else {

View File

@@ -15,9 +15,9 @@ package org.openhab.binding.juicenet.internal.handler;
import static org.openhab.binding.juicenet.internal.JuiceNetBindingConstants.*;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@@ -116,7 +116,7 @@ public class JuiceNetBridgeHandler extends BaseBridgeHandler {
*/
@Override
public Collection<Class<? extends ThingHandlerService>> getServices() {
return Collections.singleton(JuiceNetDiscoveryService.class);
return Set.of(JuiceNetDiscoveryService.class);
}
public void handleApiException(Exception e) {