You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Matthias J. Sax (Jira)" <ji...@apache.org> on 2020/07/17 02:21:00 UTC

[jira] [Resolved] (KAFKA-8296) Kafka Streams branch method raises type warnings

     [ https://issues.apache.org/jira/browse/KAFKA-8296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthias J. Sax resolved KAFKA-8296.
------------------------------------
    Resolution: Duplicate

Closing this ticket as duplicate.

> Kafka Streams branch method raises type warnings
> ------------------------------------------------
>
>                 Key: KAFKA-8296
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8296
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>            Reporter: Michael Drogalis
>            Assignee: Ivan Ponomarev
>            Priority: Minor
>
> Because the branch method in the DSL takes vargargs, using it as follows raises an unchecked type warning:
> {code:java}
>         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);
> {code}
> The compiler warns with:
> {code:java}
> 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>[]
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)