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-connectors.git
The following commit(s) were added to refs/heads/main by this push:
new 4233fbe71 refactor: use pattern matching instanceof (Java 16+) (#1721)
4233fbe71 is described below
commit 4233fbe71700d746373b0b316af60d01916c7fc2
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Fri Jun 26 16:20:23 2026 +0800
refactor: use pattern matching instanceof (Java 16+) (#1721)
Motivation:
Java 16 introduced pattern matching for instanceof, eliminating the need
for explicit casts after type checks.
Modification:
Replace old-style instanceof check with explicit cast in MqttFlowTest.
Result:
Cleaner code without redundant cast expressions.
---
mqtt-streaming/src/test/java/docs/javadsl/MqttFlowTest.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mqtt-streaming/src/test/java/docs/javadsl/MqttFlowTest.java
b/mqtt-streaming/src/test/java/docs/javadsl/MqttFlowTest.java
index ff2e2c5b6..7fb9c39c3 100644
--- a/mqtt-streaming/src/test/java/docs/javadsl/MqttFlowTest.java
+++ b/mqtt-streaming/src/test/java/docs/javadsl/MqttFlowTest.java
@@ -214,8 +214,7 @@ public class MqttFlowTest {
new ConnAck(
ConnAckFlags.None(),
ConnAckReturnCode.ConnectionAccepted())));
- } else if (cp instanceof Subscribe) {
- Subscribe subscribe = (Subscribe) cp;
+ } else if (cp instanceof Subscribe subscribe) {
Collection<Tuple2<String, ControlPacketFlags>>
topicFilters =
JavaConverters.asJavaCollectionConverter(subscribe.topicFilters())
.asJavaCollection();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]