Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Duplicate
-
None
-
None
-
None
Description
Because the branch method in the DSL takes vargargs, using it as follows raises an unchecked type warning:
KStream<String, User>[] branches = builder.<String, User>stream(inputTopic) .branch((key, user) -> "united states".equals(user.getCountry()), (key, user) -> "germany".equals(user.getCountry()), (key, user) -> "mexico".equals(user.getCountry()), (key, user) -> true);
The compiler warns with:
Warning:(39, 24) java: unchecked generic array creation for varargs parameter of type org.apache.kafka.streams.kstream.Predicate<? super java.lang.String,? super io.confluent.developer.avro.User>[]
This is unfortunate because of the way Java's type system + generics work. We could possibly fix this by adding the @SafeVarargs annotation to the branch method signatures.
Attachments
Issue Links
- is fixed by
-
KAFKA-5488 KStream.branch should not return a Array of streams we have to access by known index
- Closed
- is related to
-
KAFKA-5488 KStream.branch should not return a Array of streams we have to access by known index
- Closed
- mentioned in
-
Page Loading...