This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-http.git
The following commit(s) were added to refs/heads/main by this push:
new c246651f3 refactor: use Optional.isEmpty() (Java 11+) (#1093)
c246651f3 is described below
commit c246651f3a30740994f0022fe84f79e059e92081
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Fri Jun 26 16:23:04 2026 +0800
refactor: use Optional.isEmpty() (Java 11+) (#1093)
Motivation:
Java 11 introduced Optional.isEmpty() as a more readable counterpart to
!isPresent(), expressing the intent directly.
Modification:
Replace !system.isPresent() with system.isEmpty() in HttpApp.
Result:
Cleaner, more expressive Optional usage.
---
http/src/main/java/org/apache/pekko/http/javadsl/server/HttpApp.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/http/src/main/java/org/apache/pekko/http/javadsl/server/HttpApp.java
b/http/src/main/java/org/apache/pekko/http/javadsl/server/HttpApp.java
index 3e09123a9..561d3f3e3 100644
--- a/http/src/main/java/org/apache/pekko/http/javadsl/server/HttpApp.java
+++ b/http/src/main/java/org/apache/pekko/http/javadsl/server/HttpApp.java
@@ -131,7 +131,7 @@ public abstract class HttpApp extends AllDirectives {
.handle(
(success, exception) -> {
postServerShutdown(Optional.ofNullable(exception), theSystem);
- if (!system.isPresent()) {
+ if (system.isEmpty()) {
// we created the system. we should cleanup!
theSystem.terminate();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]