This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new fa9e1e448d2 MINOR: Fix StreamPartitioner deprecation warning in 
ProcessorTopology (#22944)
fa9e1e448d2 is described below

commit fa9e1e448d2bc48abc76d49c562ed5d76458606c
Author: Yu-Chia Ma <[email protected]>
AuthorDate: Mon Jul 27 20:56:00 2026 +0800

    MINOR: Fix StreamPartitioner deprecation warning in ProcessorTopology 
(#22944)
    
    `constantPartitioner` used a lambda, which implicitly overrides the
    deprecated 4-arg `StreamPartitioner#partitions(String, K, V, int)`.
    Since a lambda cannot be annotated with `@Deprecated`, the warning could
    not be suppressed via the lambda itself.
    
    Replaced the lambda with an anonymous class that implements the new
    5-arg `partitions(String, K, V, Headers, int)` method, and kept the
    deprecated 4-arg override (annotated `@Deprecated`) delegating to it for
    source compatibility.
    
    Reviewers: Chia-Ping Tsai <[email protected]>, Ken Huang
     <[email protected]>
---
 .../apache/kafka/streams/processor/internals/ProcessorTopologyTest.java  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorTopologyTest.java
 
b/streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorTopologyTest.java
index 55e8dddc2d3..416b5c7a37f 100644
--- 
a/streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorTopologyTest.java
+++ 
b/streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorTopologyTest.java
@@ -1074,6 +1074,7 @@ public class ProcessorTopologyTest {
         assertEquals(headers, record.headers());
     }
 
+    @SuppressWarnings({"deprecation", "removal"})
     private StreamPartitioner<String, String> constantPartitioner(final 
Integer partition) {
         return (topic, key, value, numPartitions) -> 
Optional.of(Collections.singleton(partition));
     }

Reply via email to