Hi,
for context, I’m trying to write a Apache Beam job that writes to Kafka using Kotlin. The KafkaIO package has some example code I’m trying to convert to Kotlin (under Reading Kafka Topics.
This works fine, until the last line, in Java being:
.apply(Values.<String>create())
writing this in Kotlin as
.apply(Values.create<String>())
gives me a type mismatch error.
Error:(24, 13) Kotlin: Type mismatch: inferred type is Values<String!>! but PTransform<in PCollection<KafkaRecord<Long!, String!>!>!, PCollection<String!>!>! was expected
But Values<String!>! should be a subclass of PTransform. Here’s its Javadoc: Values (Apache Beam 2.5.0)
I don’t understand why this works in Java, but not in Kotlin. What with it being a million generics deep type, there’s probably an issue there, but type stuff has always been my weak point. Any help would be appreciated.