Java 17 features (H-M) (#15520)

- 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-08 14:36:59 +02:00
committed by GitHub
parent 3751fd0646
commit edaf17b345
519 changed files with 2703 additions and 2660 deletions

View File

@@ -106,7 +106,6 @@ public class StuderHandler extends BaseThingHandler {
@Override
public void handleCommand(ChannelUID channelUID, Command command) {
// Currently we do not support any commands
}
@@ -132,7 +131,6 @@ public class StuderHandler extends BaseThingHandler {
* Start the periodic polling
*/
private void startUp() {
connectEndpoint();
if (comms == null || config == null) {
@@ -203,9 +201,8 @@ public class StuderHandler extends BaseThingHandler {
return null;
}
if (handler instanceof ModbusEndpointThingHandler) {
ModbusEndpointThingHandler slaveEndpoint = (ModbusEndpointThingHandler) handler;
return slaveEndpoint;
if (handler instanceof ModbusEndpointThingHandler thingHandler) {
return thingHandler;
} else {
logger.debug("Unexpected bridge handler: {}", handler);
return null;

View File

@@ -207,7 +207,7 @@ public class StuderParser {
* @return the converted float
*/
public @Nullable Float hexToFloat(String hex) {
String t = hex.replaceAll(" ", "");
String t = hex.replace(" ", "");
float f = Float.intBitsToFloat((int) Long.parseLong(t, 16));
if (Float.isNaN(f)) {
return null;