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:18:00 UTC
[jira] [Created] (KAFKA-8297) Kafka Streams ConsumerRecordFactory
yields difficult compiler error about generics
Michael Drogalis created KAFKA-8297:
---------------------------------------
Summary: Kafka Streams ConsumerRecordFactory yields difficult compiler error about generics
Key: KAFKA-8297
URL: https://issues.apache.org/jira/browse/KAFKA-8297
Project: Kafka
Issue Type: Bug
Components: streams
Reporter: Michael Drogalis
When using the ConsumerRecordFactory, it's convenient to specify a default topic to create records with:
{code:java}
ConsumerRecordFactory<String, User> inputFactory = new ConsumerRecordFactory<>(inputTopic, keySerializer, valueSerializer);
{code}
However, when the factory is used to create a record with a String key:
{code:java}
inputFactory.create("any string", user)
{code}
Compilation fails with the following warning:
{code:java}
Ambiguous method call. Both:
create(String, User) in ConsumerRecordFactory and
create(String, User) in ConsumerRecordFactory match
{code}
At first glance, this is a really confusing error to see during compilation. What's happening is that there are two clashing signatures for `create`: create(K, V) and create(String, V). The latter signature represents a topic name.
It seems like fixing this would require breaking the existing interface. This is a really opaque problem to hit though, and it would be great if we could avoid having users encounter this.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)