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

@@ -12,7 +12,6 @@
*/
package org.openhab.binding.vizio.internal;
import java.util.Collections;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -41,7 +40,7 @@ public class VizioBindingConstants {
// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_VIZIO_TV = new ThingTypeUID(BINDING_ID, "vizio_tv");
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_VIZIO_TV);
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_VIZIO_TV);
// List of all Channel id's
public static final String POWER = "power";

View File

@@ -61,8 +61,7 @@ public class VizioHandlerFactory extends BaseThingHandlerFactory {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) {
VizioHandler handler = new VizioHandler(thing, httpClientFactory, stateDescriptionProvider, vizioAppsJson);
return handler;
return new VizioHandler(thing, httpClientFactory, stateDescriptionProvider, vizioAppsJson);
}
return null;

View File

@@ -65,8 +65,8 @@ public class VizioCommandExtension extends AbstractConsoleCommandExtension {
VizioHandler handler = null;
if (thing != null) {
thingHandler = thing.getHandler();
if (thingHandler instanceof VizioHandler) {
handler = (VizioHandler) thingHandler;
if (thingHandler instanceof VizioHandler vizioHandler) {
handler = vizioHandler;
}
}
if (thing == null) {