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

@@ -16,7 +16,6 @@ import static org.openhab.binding.systeminfo.internal.SysteminfoBindingConstants
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collections;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -46,7 +45,7 @@ public class SysteminfoDiscoveryService extends AbstractDiscoveryService {
private final Logger logger = LoggerFactory.getLogger(SysteminfoDiscoveryService.class);
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_COMPUTER);
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_COMPUTER);
private static final int DISCOVERY_TIME_SECONDS = 30;
private static final String THING_UID_VALID_CHARS = "A-Za-z0-9_-";
@@ -82,7 +81,6 @@ public class SysteminfoDiscoveryService extends AbstractDiscoveryService {
protected String getHostName() throws UnknownHostException {
InetAddress addr = InetAddress.getLocalHost();
String hostname = addr.getHostName();
return hostname;
return addr.getHostName();
}
}

View File

@@ -675,8 +675,7 @@ public class SysteminfoHandler extends BaseThingHandler {
}
if (channelGroupID.contains(CHANNEL_GROUP_CURRENT_PROCESS)) {
int pid = systeminfo.getCurrentProcessID();
return pid;
return systeminfo.getCurrentProcessID();
}
// First try to get device index in group id, delete all non-digits from id