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

@@ -15,7 +15,6 @@ package org.openhab.binding.harmonyhub.internal.handler;
import static org.openhab.binding.harmonyhub.internal.HarmonyHubBindingConstants.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -65,7 +64,7 @@ public class HarmonyDeviceHandler extends BaseThingHandler {
private final Logger logger = LoggerFactory.getLogger(HarmonyDeviceHandler.class);
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(HARMONY_DEVICE_THING_TYPE);
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(HARMONY_DEVICE_THING_TYPE);
private final HarmonyHubDynamicTypeProvider typeProvider;

View File

@@ -126,9 +126,9 @@ public class HarmonyHubHandler extends BaseBridgeHandler implements HarmonyClien
switch (channel.getUID().getId()) {
case CHANNEL_CURRENT_ACTIVITY:
if (command instanceof DecimalType) {
if (command instanceof DecimalType decimalCommand) {
try {
client.startActivity(((DecimalType) command).intValue());
client.startActivity(decimalCommand.intValue());
} catch (Exception e) {
logger.warn("Could not start activity", e);
}