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

@@ -48,11 +48,11 @@ public class NotificationHandler {
public void handleNotification(LocationMessage msg) {
synchronized (this) {
String trackerId = msg.getTrackerId();
if (msg instanceof TransitionMessage) {
if (msg instanceof TransitionMessage message) {
List<TransitionMessage> transitionMessages = transitionNotifications.computeIfAbsent(trackerId,
k -> new ArrayList<>());
if (transitionMessages != null) {
transitionMessages.add((TransitionMessage) msg);
transitionMessages.add(message);
}
} else {
locationNotifications.put(trackerId, msg);

View File

@@ -120,9 +120,8 @@ public abstract class AbstractCallbackServlet extends HttpServlet {
if (!trackerId.isEmpty()) {
TrackerHandler recorder = getHandlerById(trackerId);
if (recorder != null) {
if (message instanceof TransitionMessage) {
TransitionMessage tm = (TransitionMessage) message;
recorder.doTransition(tm);
if (message instanceof TransitionMessage transitionMessage) {
recorder.doTransition(transitionMessage);
} else {
recorder.updateLocation(message);
}