Java 17 features (A-G) (#15516)

- 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-05 22:30:16 +02:00
committed by GitHub
parent a0dc5c05f2
commit cf10b3e9c7
486 changed files with 2053 additions and 1955 deletions

View File

@@ -41,8 +41,8 @@ public class DoorbirdActions implements ThingActions {
@Override
public void setThingHandler(@Nullable ThingHandler handler) {
if (handler instanceof DoorbellHandler) {
this.handler = (DoorbellHandler) handler;
if (handler instanceof DoorbellHandler doorbellHandler) {
this.handler = doorbellHandler;
}
}

View File

@@ -29,36 +29,40 @@ public class DoorbirdInfoTest {
private final String infoWithControllerId =
//@formatter:off
"{" +
"'BHA': {" +
"'RETURNCODE': '1'," +
"'VERSION': [{" +
"'FIRMWARE': '000109'," +
"'BUILD_NUMBER': '15120529'," +
"'PRIMARY_MAC_ADDR': '1CCAE3711111'," +
"'WIFI_MAC_ADDR': '1CCAE3799999'," +
"'RELAYS': ['1', '2', 'gggaaa@1', 'gggaaa@2']," +
"'DEVICE-TYPE': 'DoorBird D101'" +
"}]" +
"}" +
"}";
"""
{\
'BHA': {\
'RETURNCODE': '1',\
'VERSION': [{\
'FIRMWARE': '000109',\
'BUILD_NUMBER': '15120529',\
'PRIMARY_MAC_ADDR': '1CCAE3711111',\
'WIFI_MAC_ADDR': '1CCAE3799999',\
'RELAYS': ['1', '2', 'gggaaa@1', 'gggaaa@2'],\
'DEVICE-TYPE': 'DoorBird D101'\
}]\
}\
}\
""";
//@formatter:on
private final String infoWithoutControllerId =
//@formatter:off
"{" +
"'BHA': {" +
"'RETURNCODE': '1'," +
"'VERSION': [{" +
"'FIRMWARE': '000109'," +
"'BUILD_NUMBER': '15120529'," +
"'PRIMARY_MAC_ADDR': '1CCAE3711111'," +
"'WIFI_MAC_ADDR': '1CCAE3799999'," +
"'RELAYS': ['1', '2']," +
"'DEVICE-TYPE': 'DoorBird D101'" +
"}]" +
"}" +
"}";
"""
{\
'BHA': {\
'RETURNCODE': '1',\
'VERSION': [{\
'FIRMWARE': '000109',\
'BUILD_NUMBER': '15120529',\
'PRIMARY_MAC_ADDR': '1CCAE3711111',\
'WIFI_MAC_ADDR': '1CCAE3799999',\
'RELAYS': ['1', '2'],\
'DEVICE-TYPE': 'DoorBird D101'\
}]\
}\
}\
""";
//@formatter:on
@Test

View File

@@ -29,33 +29,35 @@ public class SipStatusTest {
private final String sipStatusJson =
//@formatter:off
"{" +
"'BHA': {" +
"'RETURNCODE': '1'," +
"'SIP': [{" +
"'ENABLE': '10'," +
"'PRIORITIZE_APP': '1'," +
"'REGISTER_URL': '192.168.178.1'," +
"'REGISTER_USER': 'xxxxx'," +
"'REGISTER_PASSWORD': 'yyyyy'," +
"'AUTOCALL_MOTIONSENSOR_URL': 'motion-url'," +
"'AUTOCALL_DOORBELL_URL': 'doorbell-url'," +
"'SPK_VOLUME': '70'," +
"'MIC_VOLUME': '33'," +
"'DTMF': '1'," +
"'relais:1': '0'," +
"'relais:2': '1'," +
"'LIGHT_PASSCODE': 'light-passcode'," +
"'INCOMING_CALL_ENABLE': '0'," +
"'INCOMING_CALL_USER': 'abcde'," +
"'ANC': '1'," +
"'LASTERRORCODE': '901'," +
"'LASTERRORTEXT': 'OK'," +
"'RING_TIME_LIMIT': '60'," +
"'CALL_TIME_LIMIT': '180'" +
"}]" +
"}" +
"}";
"""
{\
'BHA': {\
'RETURNCODE': '1',\
'SIP': [{\
'ENABLE': '10',\
'PRIORITIZE_APP': '1',\
'REGISTER_URL': '192.168.178.1',\
'REGISTER_USER': 'xxxxx',\
'REGISTER_PASSWORD': 'yyyyy',\
'AUTOCALL_MOTIONSENSOR_URL': 'motion-url',\
'AUTOCALL_DOORBELL_URL': 'doorbell-url',\
'SPK_VOLUME': '70',\
'MIC_VOLUME': '33',\
'DTMF': '1',\
'relais:1': '0',\
'relais:2': '1',\
'LIGHT_PASSCODE': 'light-passcode',\
'INCOMING_CALL_ENABLE': '0',\
'INCOMING_CALL_USER': 'abcde',\
'ANC': '1',\
'LASTERRORCODE': '901',\
'LASTERRORTEXT': 'OK',\
'RING_TIME_LIMIT': '60',\
'CALL_TIME_LIMIT': '180'\
}]\
}\
}\
""";
//@formatter:on
@Test