[
https://issues.apache.org/jira/browse/KAFKA-8297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matthias J. Sax resolved KAFKA-8297.
------------------------------------
Resolution: Fixed
Closing this ticket because the factory class was deprecated via
https://issues.apache.org/jira/browse/KAFKA-8233 (KIP-470) in 2.4 release, and
replaced with `TestInputTopic`.
> 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
> Priority: Minor
> Fix For: 2.4.0
>
>
> 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
(v8.3.4#803005)