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

@@ -246,7 +246,7 @@ public abstract class PentairBaseBridgeHandler extends BaseBridgeHandler {
@Override
public void run() {
logger.debug("parser thread started");
byte buf[] = new byte[40];
byte[] buf = new byte[40];
int c;
int chksum, i, length;
Thing thing;

View File

@@ -98,8 +98,8 @@ public class PentairEasyTouchHandler extends PentairBaseThingHandler {
return;
}
if (command instanceof OnOffType) {
boolean state = ((OnOffType) command) == OnOffType.ON;
if (command instanceof OnOffType onOffCommand) {
boolean state = onOffCommand == OnOffType.ON;
switch (channelUID.getId()) {
case EASYTOUCH_POOL:
@@ -154,8 +154,8 @@ public class PentairEasyTouchHandler extends PentairBaseThingHandler {
circuitSwitch(18, state);
break;
}
} else if (command instanceof DecimalType) {
int sp = ((DecimalType) command).intValue();
} else if (command instanceof DecimalType decimalCommand) {
int sp = decimalCommand.intValue();
switch (channelUID.getId()) {
case EASYTOUCH_SPASETPOINT:

View File

@@ -57,8 +57,8 @@ public class PentairSerialBridgeHandler extends PentairBaseBridgeHandler {
throw new IllegalStateException("cannot open serial port!");
}
if (cp instanceof SerialPort) {
port = (SerialPort) cp;
if (cp instanceof SerialPort serialPort) {
port = serialPort;
} else {
throw new IllegalStateException("unknown port type");
}