Java 17 features (T-Z) (#15576)

- 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-21 07:58:53 +02:00
committed by GitHub
parent bf1aa3deb2
commit 1b122a53b9
277 changed files with 1402 additions and 1298 deletions

View File

@@ -187,8 +187,8 @@ public class TeleinfoDiscoveryService extends AbstractDiscoveryService
@Override
public void setThingHandler(@Nullable ThingHandler handler) {
if (handler instanceof TeleinfoAbstractControllerHandler) {
controllerHandler = (TeleinfoAbstractControllerHandler) handler;
if (handler instanceof TeleinfoAbstractControllerHandler teleinfoAbstractControllerHandler) {
controllerHandler = teleinfoAbstractControllerHandler;
}
}

View File

@@ -13,7 +13,6 @@
package org.openhab.binding.teleinfo.internal.handler;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -52,6 +51,6 @@ public abstract class TeleinfoAbstractControllerHandler extends BaseBridgeHandle
@Override
public Collection<Class<? extends ThingHandlerService>> getServices() {
return Collections.singleton(TeleinfoDiscoveryService.class);
return Set.of(TeleinfoDiscoveryService.class);
}
}