You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Michael Drogalis (JIRA)" <ji...@apache.org> on 2019/04/26 20:09:00 UTC

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

Michael Drogalis created KAFKA-8296:
---------------------------------------

             Summary: 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


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
(v7.6.3#76005)