Java 17 features (A-G) (#15516)

- 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-05 22:30:16 +02:00
committed by GitHub
parent a0dc5c05f2
commit cf10b3e9c7
486 changed files with 2053 additions and 1955 deletions

View File

@@ -21,8 +21,8 @@ import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.format.FormatStyle;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@@ -262,7 +262,7 @@ public class GardenaAccountHandler extends BaseBridgeHandler implements GardenaS
@Override
public Collection<Class<? extends ThingHandlerService>> getServices() {
return Collections.singleton(GardenaDeviceDiscoveryService.class);
return Set.of(GardenaDeviceDiscoveryService.class);
}
@Override

View File

@@ -231,7 +231,7 @@ public class GardenaThingHandler extends BaseThingHandler {
public void handleCommand(ChannelUID channelUID, Command command) {
logger.debug("Command received: {}", command);
try {
boolean isOnCommand = command instanceof OnOffType && ((OnOffType) command) == OnOffType.ON;
boolean isOnCommand = command instanceof OnOffType onOffCommand && onOffCommand == OnOffType.ON;
String dataItemProperty = getDeviceDataItemProperty(channelUID);
if (RefreshType.REFRESH == command) {
logger.debug("Refreshing Gardena connection");

View File

@@ -20,7 +20,7 @@ package org.openhab.binding.gardena.internal.model.dto.command;
public class ValveCommand extends GardenaCommand {
private static final String COMMAND_TYPE = "VALVE_CONTROL";
public static enum ValveControl {
public enum ValveControl {
START_SECONDS_TO_OVERRIDE,
STOP_UNTIL_NEXT_TASK,
PAUSE,