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:
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user