I did the experiments and the most flexible declaration that worked with the 
lambda is the following:
```
<K1, V1> KStream<K1, V1> transform(final TransformerSupplier<? super K, ? super 
V, ? extends KeyValue<K1, V1>> transformerSupplier,
                                   final String... stateStoreNames);
```
With this declaration, the `Transformer` may not return keys and values of 
subclasses of the key type and the value type of the result stream. Thus, the 
examples with `stream4` and `stream5` in @vvcephei 's experiments above do not 
compile with this declaration.

If nobody objects, I will proceed with the declaration above.

Removing only the `? extends` in front of `KeyValue` instead of removing `? 
extends` from `K1` and `V1` does also not compile when using lambdas. 

FYI, I created a minimal example of this rather strange compiler behavior and 
posted a question on stackoverflow [1].

[1] 
https://stackoverflow.com/questions/52445222/java-using-lambda-impedes-inference-of-type-variable
     

[ Full content available at: https://github.com/apache/kafka/pull/5273 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to